🖼️ Image to Base64 Converter
Convert images to Base64 strings or decode Base64 back to images. Runs in your browser.
Last updated: November 8, 2026 · By the BoltQuickTools team
Putting an image inside your code, or getting one back out
Sometimes a small icon has to live inside a CSS file, an HTML email or a JSON payload instead of sitting at its own URL. Other times an API hands you a long Base64 string and you just want to see the picture. This page does both directions.
Working in each direction
On the Image to Base64 tab, drop a file on the zone or click it to browse. PNG, JPG, WebP, GIF, SVG and ICO are accepted. Four cards report Dimensions, File Size, MIME Type and Encoded Size, and five boxes appear, each with its own Copy button: Raw Base64, Data URI, HTML <img> Tag, CSS background-image and Markdown Image.
On the Base64 to Image tab, paste into "Paste Base64 string or Data URI". Pasting decodes automatically; if you typed the value, press Decode. Download Image saves the result as decoded-image plus an extension, and Clear empties the form.
Encoding a 98-byte SVG
A file named dot.svg containing this text:
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><circle cx="5" cy="5" r="4"/></svg>
reports Dimensions 10 x 10 px, File Size 98 B, MIME Type image/svg+xml and Encoded Size 132 B (+34.7%). The CSS box then holds:
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCI+PGNpcmNsZSBjeD0iNSIgY3k9IjUiIHI9IjQiLz48L3N2Zz4=');
In the other direction, this string is a real 1 by 1 PNG of 70 bytes:
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
It decodes to Dimensions 1 x 1 px, Detected Format image/png and Estimated Size 72 B. The estimate is simply length times three quarters, so padding characters make it read slightly high.
Behaviour worth knowing first
- Encoded Size counts only the Base64 characters. The
data:...;base64,prefix and any wrapping markup add more on top. - Raw strings are identified from their first bytes: PNG, JPEG, GIF, WebP, ICO, or text beginning with
<svgor<?xml. Anything else is labelled image/png. An SVG that opens with a comment or doctype gets that label and fails with the "Failed to decode" alert. Paste it as a full data URI instead. - A data URI that is not Base64, such as a URL-encoded
data:image/svg+xml,%3Csvg..., still previews, but Detected Format says image/png, Estimated Size is meaningless, and Download Image saves SVG text under a .png name. - If a file has an image extension but is not really an image, the encoder shows no error. The previous output simply stays on screen, except for a fake .svg, which reports Dimensions 0 x 0 px and still fills the boxes.
- There is no size limit in the code, but all five boxes hold the whole string, so a multi-megabyte photo makes the page slow. Inlining that much rarely makes sense anyway.
Common questions
Does encoding compress or change the image?
No. The file bytes are converted to text as they are, so an animated GIF stays animated and quality does not change. If you need it smaller, run it through the Image Compressor first.
Will my photo's location data end up in the string?
It will if the file contains it, because the bytes are not altered. Check or strip metadata with the EXIF Viewer before embedding a camera photo.
Is the image sent to a server?
This tool's code reads the file with the browser's FileReader and builds every output locally. It makes no network request with your image.
When should I use the plain Base64 tool instead?
For text, or for files that are not images, use the Base64 Encoder and Decoder. This page is the better fit when you want the preview and ready-made image markup.