SVG to data URI converter
Embed an SVG straight into CSS or HTML without a separate file. Get a compact URL-encoded data URI (usually smaller than base64 for SVG) or a base64 one, in the quote style your code uses, optionally shrunk with SVGO first, and snippets ready to paste: a CSS background, a CSS mask that makes the icon follow the text colour, an <img> tag and a custom property. Drop a whole icon set to get one stylesheet with a class per icon, or paste a data URI to get the SVG back.
How to use it
- 1
Drop an SVG (or several) or paste its code.
- 2
Choose URL-encoded (smaller) or base64, the quote style, and whether to optimize first.
- 3
Copy the data URI or a snippet, or download icons.css for the whole set.
Questions
URL-encoded or base64 — which should I use?
URL-encoded is usually smaller for SVG because the markup stays readable text; base64 inflates it by about a third. Use base64 only where a tool requires it.
Can I change the color of an SVG used as a background?
Not as a background — the colors are baked in. Use the CSS mask snippet instead: the SVG becomes the shape and the element's background-color (currentColor in the snippet) fills it, so the icon follows the text color.
Double or single quotes?
Pick the quotes your CSS or HTML wraps the URI in. The URI is encoded so it never contains that quote, so url("…") and url('…') both stay valid.
How do I turn a data URI back into an SVG?
Open Decode a data URI, paste it — URL-encoded, base64, or wrapped in url("…") — and copy or download the SVG, or send it to the converter.
Is there a size limit?
Browsers accept very large data URIs, but big ones bloat your CSS and can't be cached separately. They suit small icons and patterns best.
More free SVG tools
Need more than one change?
The Splice editor edits SVGs visually — shapes, text, colors, layers — across many files at once, with the code in sync.
Open the editor