SVG URL encoder
Convert SVG markup into a CSS-ready data URI and decode data URIs back to SVG.
Related tools
SVG URL encoder
Paste an SVG and get a data URI you can drop straight into CSS, ready for background-image or a mask. Instead of base64, the encoder uses the compact URL-encoding approach: it swaps double quotes for single quotes, collapses whitespace, and percent-encodes only the characters that actually need it, so the result stays short and human-readable. That keeps your stylesheet smaller than a base64 blob and lets you still recognise the shapes inside the URI.
Three output formats cover the common cases. The CSS rule wraps the data URI in background-image: url("…"); so you can paste a whole declaration. The bare data URI gives you just the value for a custom property, an <img> src or an SVG mask. The base64 form produces a UTF-8-safe data:image/svg+xml;base64 URI for tools or build steps that expect that encoding, including SVGs with emoji or accented text nodes.
Switch the direction to decoding and the tool reverses any of the three forms back to raw SVG markup. Paste a CSS rule, a bare data URI or a base64 one, and it extracts the SVG so you can edit an icon that only exists inside a stylesheet. The tally shows the input size, the output size and the percentage change, so you can see at a glance whether encoding shrank or grew the icon.
Everything runs in your browser. Your SVG markup is never uploaded, so you can encode private icons, logos and internal assets without them leaving your device.