SVG to Base64

Turn SVG icons into data URIs for CSS backgrounds and HTML. Choose Base64, or the shorter URL encoded form that keeps the SVG readable.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Add your SVGOpen the file or drop it onto the input box. You can also paste Base64 directly.
  2. Choose the outputPick data URI, Base64, CSS, HTML or Markdown. The preview and sizes update right away.
  3. Copy or downloadCopy the code with one click, or download the image as a file.

Base64 or URL encoded?

SVG is text, so it does not need Base64. Turn on the URL encoding option and the tool keeps the SVG as text, encodes only the characters that would break it and gives you a result that is usually shorter and compresses better.

Base64 is still useful when a system only accepts Base64 data URIs, so both forms are one click away.

About SVG

SVG is a text based vector format. Because it is already text, it can also be embedded without Base64, which often gives a shorter result.

About Base64

Base64 writes binary data as plain text using letters, digits, + and /. A data URI adds the file type in front, for example data:image/png;base64, so browsers know how to show it.

Frequently asked questions

Can I change the icon color later?

Not with CSS color, because the SVG becomes a background image. Edit the fill color in the SVG before converting, or use the URL encoded form and change the color value in the text.

Is my image uploaded?

No. The image is read and converted in your browser and never sent to our servers.

Is there a size limit?

There is no fixed limit, but data URIs over about 100 KB make pages and stylesheets heavy. For large images a normal image file is the better choice.

Can I convert other files, like PDFs or fonts?

Yes. Any file becomes a data URI or plain Base64. The CSS, HTML and Markdown options are only offered for images.

How do I turn Base64 back into an image?

Paste the Base64 text or data URI into the input box. The image is shown right away and Download saves it with the right file extension.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.