URL encoding is often smaller
For text-heavy SVG markup, a carefully escaped data URI is commonly shorter than base64 and remains partly readable.
Free SVG utility
Encode any SVG for CSS backgrounds, img tags, and embeds.
Why this tool exists
A data URI packages the SVG markup into a value that CSS or HTML can use without a separate asset request. Generate both compact URL-encoded output and base64 when a target system requires it.
How to use it
Paste markup or load a file. The preview helps catch malformed input before encoding.
Use URL encoding for readable CSS, or base64 for tools that explicitly require it.
Copy the raw URI, a CSS background declaration, or a ready-to-use img element.
For text-heavy SVG markup, a carefully escaped data URI is commonly shorter than base64 and remains partly readable.
Inlining large artwork increases HTML or CSS size and prevents separate browser caching. Keep external files for substantial illustrations.
The generated CSS snippet is quoted and escapes SVG characters that would otherwise break a declaration.
Encoding and snippet generation are handled entirely in your browser.
Keep working
Optimize and clean SVG files online for free. Remove comments, XML declarations, and extra whitespace to shrink markup without changing the design.
Convert SVG code to JSX for React online for free. Turn any SVG into a React component with camelCase attributes, ready to paste.
Replace fill and stroke colors in an SVG file online for free. Recolor individual colors or swap the whole palette — no install needed.
Good to know
Data URIs let you embed the SVG directly in CSS (background-image) or an <img> tag — one fewer HTTP request and no separate asset file.
No. This tool runs in your browser, so your SVG stays in the current tab and is not uploaded to GenSVG.
The tool does not add a watermark or a new license. Your right to use the result depends on the license and ownership of the source artwork you provide.