SVG to Base64

Tips: Use Data URI (Base64) for HTML img src, CSS url(), and inline assets. Use Data URI (UTF-8) if you want a readable URI for small SVGs.

Output Settings

Notes: Base64 increases size by about 33%. If you are using CSS url(), consider Data URI (UTF-8) for small SVGs.
Output
Preview
Preview is unavailable for this output mode without a data URI prefix.

SVG to Base64 Converter (Data URI)

Convert an SVG to Base64 or generate a full SVG data URI for HTML, CSS, and JavaScript. This tool is built for practical embedding workflows: you feed it SVG, choose an output format, and it produces a copy-ready string that you can paste into your codebase. The most common output starts with data:image/svg+xml;base64, followed by the encoded SVG. Everything runs locally in your browser, so your SVG is not uploaded.

HTML
Use in <img src="..." />, demos, or documentation snippets.
CSS
Use in background-image: url("...") for icons and UI patterns.
JS
Store in JSON, configs, or theme assets without separate files.

Outputs you can generate

1) Data URI (Base64)

Produces a full data: URL that you can paste directly into src, href, or CSS url(). This is the least surprising option for mixed environments because it avoids special character issues and tends to survive copy/paste across tools.

2) Base64 only

Produces just the encoded payload without the data:image/svg+xml;base64, prefix. This is useful when your app adds the prefix at runtime, when you store only the payload in a database/config, or when you need to compare or hash the output consistently.

3) Data URI (UTF-8)

Produces a URL-encoded UTF-8 data URI, not Base64. For small, simple icons, this can be smaller than Base64 and remains readable. For CSS, the CSS-safe mode escapes additional characters that frequently break url() or get interpreted as CSS syntax.

Best default choices
Want maximum compatibility
Use Data URI (Base64). It is larger, but it reduces encoding edge cases and tends to just work.
Want smallest output for icons
Try Data URI (UTF-8) with CSS-safe when targeting CSS usage.
Storing in configs or JSON
Use Base64 only and add the prefix only when you need a full data URI at runtime.
Avoid surprises in CSS
Wrap the URI in quotes inside url("...") and prefer UTF-8 CSS-safe or Base64 if your pipeline is strict.

When to use this instead of the embed code generator

Use this SVG to Base64 route when the output you need is the encoded string itself: a Base64 payload, a UTF-8 SVG data URI, or a quoted snippet for HTML and CSS. It is an encoding tool, not raster conversion or image compression.

Use SVG to Base64

When a config, CSS rule, test fixture, JSON value, or single-file demo needs an encoded SVG string.

Use embed code generator

When you want complete HTML, inline SVG, CSS mask, object, iframe, or framework-oriented embed snippets.

How to Convert SVG to Base64

Generate a Base64 string or a data URI for your SVG in seconds.

  1. 1. Upload, paste, or edit your SVG source.
  2. 2. Choose an output format: Data URI (Base64), Base64 only, or Data URI (UTF-8).
  3. 3. Enable sanitizing and light minification.
  4. 4. Copy the result or download it as a text file.

Base64 vs UTF-8 Data URI

Base64 data URIs

Base64 is the most compatible option across browsers and tooling, but it increases output size, often about one third bigger than the original. Use it when you want fewer surprises.

UTF-8 data URIs

UTF-8 data URIs can be smaller for simple SVG icons and remain readable. For CSS usage, the CSS-safe mode escapes extra characters that may break url().

Where this is useful in real code

CSS background icons without extra requests

If you have small UI assets like chevrons, checkmarks, or badges, a data URI removes the need for separate files and avoids additional network requests.

Single-file demos and sandboxes

Data URIs are ideal when you want a self-contained HTML file that can be shared or saved offline without an assets folder.

Theme/config storage

If your app loads theme assets from JSON or a database, a Base64 payload can travel as plain text and be rehydrated into a data URI at runtime.

Quick snippets for docs and internal tools

When you need an instant, copyable snippet for documentation, issue trackers, or internal dashboards, a data URI is a fast drop-in asset.

Common Use Cases

  • Embedding icons into CSS themes without separate files
  • Shipping a single-file HTML demo with no asset requests
  • Storing small SVGs inside JSON, configs, or localStorage
  • Generating quick <img> snippets for docs
  • Inlining assets for email templates or limited environments

Security Notes

SVG can contain scripts, event handlers, and risky links. If you plan to embed untrusted SVG content, keep sanitizing enabled to remove <script>, inline on* handlers, and javascript: URLs before encoding.

Practical rule
Do not Base64-encode SVG as a way to hide risky content. If the SVG is untrusted, sanitize first, then encode.

Troubleshooting

My CSS background-image does not render

Try Data URI (UTF-8) with CSS-safe encoding. Also confirm the URI is wrapped in quotes inside url("...").

The output is huge

Enable whitespace minification and style cleanup. For simple icons, UTF-8 mode may reduce size compared to Base64.

Preview is blank

Preview requires a full data URI. If you selected Base64-only, enable “Include prefix” or switch to a data URI output mode.

SVG Base64 workflow

SVG to Base64 for data URLs, CSS embeds, HTML snippets, and prototypes

Use this page when you already have SVG markup and need encoded output for a data URL, CSS background, HTML image source, documentation, or quick prototype.

Best for

  • svg to base64, SVG data URL, Base64 SVG, and encode SVG searches.
  • Small SVG icons, code snippets, CSS embeds, email prototypes, and documentation examples.
  • Users who need copy-ready Base64 or UTF-8 data URI output.

Settings to try

  • Choose Base64 or UTF-8 data URL output based on where the SVG will be pasted.
  • Use sanitization and minification before encoding unknown or messy SVG markup.
  • Copy snippets for code, or download output when you need a reusable file.

Useful limits

  • Base64 makes source text longer and can be awkward for large SVGs.
  • This route encodes SVG data; it does not trace PNG or JPG files.
  • Use SVG cleaner first if the markup contains editor junk or unsafe content.

Need help choosing?

Read the concise workflow, preset, settings, and troubleshooting docs without adding clutter to the converter.

FAQ

How do I convert SVG to Base64?+
Upload an SVG and the tool generates a Base64 string or a full data:image/svg+xml;base64,... data URI instantly. Then copy or download the output.
What is an SVG Base64 data URI?+
A data URI embeds the SVG content directly in HTML or CSS. It usually starts with data:image/svg+xml;base64, followed by the Base64-encoded SVG.
Should I use Base64 or UTF-8 data URIs for SVG?+
Base64 is widely compatible but increases size. UTF-8 data URIs can be smaller and readable for simple SVGs, especially for CSS usage. If you use CSS url(), pick the CSS-safe UTF-8 mode.
Does this tool upload my SVG?+
No. Everything runs client-side in your browser. Your SVG is not uploaded to any server.
Can I use the output in CSS background-image?+
Yes. Use the Copy CSS button to get a ready-to-paste background-image: url("..."); snippet.

All SVG tools

Browse every SVG converter, editor, inspector, optimizer, and craft-file utility available on iLoveSVG.

Image to SVG converters

Convert raster images, logos, drawings, sketches, scans, text, stickers, and outlines into scalable SVG files.

Image -> SVG
Convert an image into an SVG vector for scaling, logos, icons, and clean print output.
Convert
Open tool
PNG -> SVG
Convert PNG images to SVG vectors for scalable logos, icons, graphics, and print-ready artwork.
Convert
Open tool
JPG -> SVG
Convert JPG images into scalable SVG files for web graphics, posters, and print projects.
Convert
Open tool
JPEG -> SVG
Convert JPEG images to SVG with clean vector-style output for resizing without blur.
Convert
Open tool
WebP -> SVG
Convert WebP images to SVG for scalable assets and consistent rendering across sizes.
Convert
Open tool
Logo -> SVG
Turn a logo into a scalable SVG for brand kits, websites, printing, and sharp resizing.
Convert
Open tool
Icon -> SVG
Convert icons to SVG for crisp scaling, theming, UI use, and consistent rendering.
Convert
Open tool
Emoji -> SVG
Convert emoji-style images to SVG for scalable stickers, icons, overlays, and graphics.
Convert
Open tool
Text -> SVG
Convert text into SVG for logos, wordmarks, headings, and scalable typography graphics.
Convert
Open tool
Sticker -> SVG
Convert sticker images to SVG for clean cut lines, scaling, decals, and print-ready output.
Convert
Open tool
Line Art -> SVG
Convert line art into SVG for crisp outlines, coloring pages, decals, and cut-friendly paths.
Convert
Open tool
Drawing -> SVG
Convert a drawing into SVG so it stays sharp at any size for prints, merch, and design edits.
Convert
Open tool
Scan -> SVG
Convert scanned images to SVG for cleanup, scaling, document graphics, and printable art.
Convert
Open tool
Sketch -> SVG
Vectorize sketches into SVG for clean scaling, editing, and consistent line output.
Convert
Open tool
Image -> Outline
Generate an outline SVG from an image for clean line art, decals, and cut-ready shapes.
Convert
Open tool
Photo -> Outline
Create an outline-style SVG from a photo for posters, stickers, simplified art, and decals.
Convert
Open tool
B&W -> SVG
Convert black and white images to SVG with clear edges for stencils, decals, signs, and prints.
Convert
Open tool
GIF -> SVG
Convert static GIF artwork, old web graphics, transparent GIFs, and sticker-style art into SVG.
Convert
Open tool
AVIF -> SVG
Convert AVIF graphics into SVG for modern web artwork, logos, icons, and illustration cleanup.
Convert
Open tool
BMP -> SVG
Convert BMP files into SVG for legacy bitmap art, scans, line art, and old archive graphics.
Convert
Open tool
TIFF -> SVG
Convert TIFF scans and archival artwork into SVG for cleanup, line extraction, and print handoff.
Convert
Open tool
Transparent PNG -> SVG
Convert transparent PNG logos, stickers, and product art into SVG with background-aware tracing.
Convert
Open tool
Image -> Layered SVG
Create layered SVG output from image artwork for editable color regions and creator workflows.
Convert
Open tool
JPG -> Layered SVG
Convert JPG artwork into layered SVG output for separated colors and editable creator assets.
Convert
Open tool
Logo -> Layered SVG
Convert logo artwork into layered SVG output for separated colors, brand marks, and reusable graphics.
Convert
Open tool

Cricut, stickers, vinyl, Etsy, Silhouette, and laser cutting

Tools for craft workflows, cut files, layered SVG output, vinyl projects, stickers, Print Then Cut, Etsy listings, Silhouette projects, and laser cutting prep.

Cricut SVG Converter
Convert artwork into SVG files for Cricut Design Space, vinyl decals, stickers, labels, stencils, cards, and craft projects.
Craft
Open tool
Image -> Cricut SVG
Convert PNG, JPG, WebP, GIF, BMP, TIFF, AVIF, HEIC, HEIF, or SVG files into Cricut-friendly SVG output.
Craft
Open tool
PNG -> Cricut SVG
Convert PNG images into Cricut-friendly SVG files for cut files, decals, stickers, and crafts.
Craft
Open tool
JPG -> Cricut SVG
Convert JPG images into Cricut-friendly SVG files for stickers, decals, vinyl, labels, and craft projects.
Craft
Open tool
JPEG -> Cricut SVG
Convert JPEG images into Cricut-friendly SVG files for cut files, decals, stickers, and craft use.
Craft
Open tool
WebP -> Cricut SVG
Convert WebP images into Cricut-friendly SVG files for Design Space, vinyl, stickers, and crafts.
Craft
Open tool
Photo -> Cricut SVG
Convert photos into Cricut-friendly SVG output for simplified art, decals, stickers, and craft projects.
Craft
Open tool
B&W -> Cricut SVG
Convert black and white images into Cricut-friendly SVG files for stencils, decals, stickers, and signs.
Craft
Open tool
Line Art -> Cricut SVG
Convert line art into Cricut-friendly SVG outlines for decals, coloring pages, vinyl, and cut projects.
Craft
Open tool
Drawing -> Cricut SVG
Convert drawings into Cricut-friendly SVG files for craft projects, stickers, decals, and vinyl cuts.
Craft
Open tool
Sketch -> Cricut SVG
Convert sketches into Cricut-friendly SVG files for decals, labels, stickers, and cut-file workflows.
Craft
Open tool
Sticker -> Cricut SVG
Convert sticker artwork into Cricut-friendly SVG files for Print Then Cut, decals, labels, and sticker sheets.
Craft
Open tool
Logo -> Cricut SVG
Convert logo files into Cricut-friendly SVG cut files for decals, branding, signs, labels, and craft projects.
Craft
Open tool
Base64 -> Cricut SVG
Decode Base64 SVG data and prepare the SVG for Cricut Design Space, downloads, and craft workflows.
Craft
Open tool
Code -> Cricut SVG
Convert SVG code or markup into a downloadable Cricut-friendly SVG file for Design Space.
Craft
Open tool
Layered Cricut SVG
Create or prepare layered SVG files for Cricut projects, multicolor artwork, vinyl, stickers, and craft designs.
Craft
Open tool
Image -> Layered SVG
Convert PNG or JPG images into color-separated layered SVG files for Cricut Design Space.
Craft
Open tool
PNG -> Layered SVG
Create layered SVG output from PNG artwork for Cricut projects, vinyl, stickers, and multicolor designs.
Craft
Open tool
JPG -> Layered SVG
Convert JPG or JPEG images into color-separated layered SVG files for Cricut Design Space.
Craft
Open tool
Logo -> Layered SVG
Convert logos into layered SVG files for Cricut projects with editable color-separated layers.
Craft
Open tool
Print Then Cut SVG
Prepare PNG artwork for Cricut Print Then Cut workflows, stickers, labels, and printable designs.
Craft
Open tool
Vinyl Cricut SVG
Convert PNG artwork into SVG files for Cricut vinyl projects, decals, and cut-friendly designs.
Craft
Open tool
Sticker Cricut SVG
Turn PNG sticker artwork into SVG files for Cricut sticker projects, decals, labels, and prints.
Craft
Open tool
PNG -> Etsy SVG
Convert PNG designs into SVG files for Etsy digital downloads, craft bundles, decals, stickers, and printable product listings.
Craft
Open tool
PNG -> Silhouette SVG
Convert PNG artwork into SVG files for Silhouette Studio projects, decals, stickers, labels, and cut-file workflows.
Craft
Open tool
Laser Cut SVG
Convert PNG artwork into SVG files for laser cutting, engraving prep, outlines, and cut paths.
Craft
Open tool

Seller, Shopify, Etsy, and store asset workflows

Focused routes for shop graphics, listing previews, store logos, favicons, seller exports, and ecommerce asset cleanup.

Print-on-demand and printing prep

Export transparent PNG files, sticker previews, product mockup assets, and practical print handoff graphics from SVG artwork.

Glowforge, Silhouette, and laser prep

Convert, clean, and resize SVG artwork for laser, vinyl, sticker, decal, and cutting software workflows.

Canva and Figma handoff

Prepare SVG and PNG files for design app handoff, predictable sizing, cleanup, and flattened previews.

Developer SVG utilities

Convert SVG markup into JSX, embed snippets, Base64 output, and cleaner code-oriented assets without changing converter behavior.

SVG to image and PDF converters

Export SVG files to PNG, JPG, WebP, PDF, and favicon formats for web, print, sharing, and app icons.

SVG editors

Edit common SVG properties such as background, size, scale, color, stroke width, rotation, and flipping.

SVG viewers, inspectors, and embed tools

Preview SVGs, inspect dimensions and file size, generate embed code, compare inline SVG vs img, and check accessibility.

SVG cleanup and optimization

Clean and minify SVG markup so files are easier to ship, embed, and maintain.

Base64 and color tools

Encode or decode SVG Base64 data, generate data URLs, and pick or extract colors from graphics.

Follow i🩵SVG On Social Media