SVG to Base64 & Data URI Encoder
Paste SVG code, get a base64 or URL-encoded data URI plus a ready-to-paste CSS snippet, instantly, in your browser.
Runs Entirely in Your Browser
This tool doesn't touch a server, your SVG is encoded entirely inside your browser using client-side JavaScript, then discarded the moment you leave the page. Nothing is stored, logged, or sent anywhere, which matters if the icon or graphic you're converting is proprietary or hasn't shipped yet. You can technically run it offline once the page has loaded.
One SVG, Three Ready-To-Use Formats
SVG markup can be encoded two ways for embedding: standard Base64, which works everywhere but adds roughly 33% to the file size, and URL-encoding, which stays smaller for simple SVGs but can break on more complex markup with special characters. This tool supports both, and packages the result into three ready-to-use formats — a raw Base64 string, a complete Data URI (data:image/svg+xml;base64,...), and a CSS background-image snippet you can paste directly into a stylesheet.
Base64
The raw encoded text, useful when embedding into your own custom format.
Data URI
A complete, ready-to-render string for an <img src> or CSS url().
CSS background-image
A full snippet you can paste directly into a stylesheet.
Common Use Cases
Inline icons in CSS
Embed a small icon directly as a background-image without adding an extra HTTP request for a separate file.
Icons in HTML emails
Inline an SVG as a Data URI inside an <img> tag, since many email clients block externally linked images by default.
Store icons in JSON or config files
Keep a logo or icon inline as a string inside a design token file, API response, or app configuration.
One-off icons that don't need caching
Skip a separate file request for an icon used in just one place, where browser caching wouldn't offer much benefit anyway.
Preview before committing to production
Check how an SVG actually renders as a Data URI before wiring it into your codebase or design system.
Share a self-contained snippet
Send a single copy-pasteable string that includes the full icon, without needing to attach or link a separate file.