SVG to Base64 Converter
Turn SVG markup into a Data URI for CSS backgrounds or inline HTML. Get ready-to-use snippets in four flavours: URL-encoded CSS background, Base64 CSS background, HTML img tag and raw Data URI. Live SVG preview confirms the rendering before you copy.
How to use
Paste your SVG code
Drop the raw SVG markup into the input field.
Preview the SVG
See a live preview of the rendered SVG above the output.
Choose a snippet
Pick CSS background (URL-encoded or Base64), HTML img, or raw Data URI.
Copy the snippet
Copy the ready-to-use snippet and paste it into your CSS or HTML.
Ready to Use Snippets
Features
URL-encoded and Base64 output
Both options are provided — URL-encoding is usually smaller and compresses better.
Live SVG preview
See the SVG rendered so you can confirm it is correct before copying.
Ready-to-use snippets
CSS background, HTML img tag, and raw Data URI — copy-paste ready.
Optimal badge
Marks the URL-encoded version as optimal for size when applicable.
Common use cases
- Embed a small icon as a CSS background
- Inline an SVG in an HTML img tag without an extra HTTP request
- Reduce requests by inlining SVGs in a stylesheet
- Prepare Data URIs for build tools