Non-UTF-8 characters
Hand-edited SVG saved with a non-UTF-8 encoding will corrupt the Base64 output.
Fix: Save the SVG as UTF-8 (no BOM) and re-upload.
header • up to 320x100 / 728x90
Encode SVG vector images as Base64 data URLs so you can paste them directly into CSS background-image or HTML
content bottom • up to 300x250
sidebar • 160x600
Last reviewed:
SVG is an XML-based vector graphics format that scales losslessly at any resolution. Encoding SVG as Base64 wraps the XML into a text-safe data URL so it can be embedded without a separate file.
SVG to Base64 Encoder takes a .svg file and returns a `data:image/svg+xml;base64,…` string — ideal for CSS `background-image` values that cannot reference local files.
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><circle cx="8" cy="8" r="7" fill="#3b82f6"/></svg>
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PGNpcmNsZSBjeD0iOCIgY3k9IjgiIHI9IjciIGZpbGw9IiMzYjgyZjYiLz48L3N2Zz4=
Hand-edited SVG saved with a non-UTF-8 encoding will corrupt the Base64 output.
Fix: Save the SVG as UTF-8 (no BOM) and re-upload.
Base64 adds ~33% overhead vs. URL-encoded SVG.
Fix: For tiny SVGs, consider the URL-encoded `data:image/svg+xml;utf8,…` form instead.
Encoding is byte-for-byte, so embedded `<script>` blocks are preserved — but most browsers disable scripts in images loaded via `<img>` or `background-image`.
No. All encoding happens in your browser.
Yes — use the Base64 to SVG tool to recover the XML source.
Base64 is more reliable when the SVG contains `#`, `<`, `>`, or quote characters that need URL escaping.
Related encoders and vector tools: You can also browse the full Encoders & Decoders category for more options.
Decode a Base64 SVG data URL back into the original XML and preview it safely in the browser
Minify SVG markup by removing comments, extra whitespace, and redundant decimal precision
Encode PNG images as Base64 data URLs with transparency preserved for inline CSS, HTML, and emails
Convert local image files into Base64 text ready to paste into email, JSON payloads, or data URLs
Encode or decode Base64 strings
Format and beautify XML documents online with proper indentation and line breaks. Validate XML syntax while formatting for clean, readable markup.
Minify XML documents by removing whitespace, comments, and redundant formatting. Reduce XML payload size for faster API responses and data transfers.
Resize any image to exact pixel dimensions or a percentage, with optional aspect-ratio lock and instant PNG/JPG export
Convert BMP bitmap images into Base64 data URLs for embedding in HTML, email, or legacy apps
Turn GIF images (including animated GIFs) into Base64 data URLs ready to embed inline in HTML or CSS
Encode .ico favicon files as Base64 data URLs for inline HTML favicons or web manifests
Convert JPG or JPEG images into Base64 data URLs for inline HTML, CSS, or JSON — 100% browser-based