Skip to content

Base64 to Image Converter

Paste a base64 string or a data URL and get the picture back, ready to download. Handles missing prefixes, stray line breaks and URL-safe encoding. Nothing is sent anywhere.

Updated May 2026 · Free · Works entirely in your browser

What base64 is for

Base64 rewrites binary data using only 64 characters that survive being pasted into text — the letters, digits, plus and slash. That lets an image travel through channels built for text: inside an HTML file, in a CSS stylesheet, in a JSON API response, in an email body, in a YAML config.

The cost is size. Every three bytes of the original become four characters, so a base64 string is about 33% larger than the file it encodes. That is fine for a 2 KB icon and a genuine problem for a 2 MB photograph.

Reading a data URL

A full data URL looks like data:image/png;base64,iVBORw0KGgo… and has three parts: the media type, the encoding, and the payload. Together they tell the browser everything it needs to render the image without fetching anything.

If your string has no prefix, the format can still be worked out from how it begins, because each format starts with a recognisable signature:

Starts withFormat
iVBORw0KGgoPNG
/9j/JPEG
R0lGODlh or R0lGODdhGIF
UklGRWEBP
Qk0BMP
PHN2Zy or PD94bWwSVG

Why a paste sometimes fails

  • Line breaks. Editors wrap long strings. Harmless, and stripped automatically here.
  • URL-safe base64. Some APIs use hyphen and underscore in place of plus and slash so the string can sit in a URL. Also handled automatically.
  • Missing padding. The trailing equals signs are sometimes dropped. They are restored here.
  • A truncated copy. The usual real failure — the selection stopped short. Nothing can recover a string that is missing its end; go back and copy it all.
  • It is not an image. Base64 encodes any binary. A PDF, a font or a ZIP will decode fine and then fail to display.

When to embed an image as base64, and when not to

Worth it for tiny assets that would otherwise cost a separate network request: an icon in a CSS file, a logo in an email template, a placeholder in a single-file HTML export, a small image inside a JSON payload.

Not worth it for anything large. A base64 image cannot be cached separately from the file it lives in, so every page load carries it again, and it blocks parsing while it is read. As a rough line, under about 4 KB is usually a win; above that, serve a real file.

A note on pasting things you did not create

Base64 blobs often come out of API responses, browser storage and config files, and can carry more than you expect — including metadata in the original image. Decoding here happens entirely in your browser and nothing is transmitted, which is worth knowing before pasting something sensitive into any online tool.

Frequently Asked Questions

Everything you need to know about image conversion.

It is an image file rewritten using only 64 printable characters, so it can travel anywhere text can — inside an HTML file, a CSS stylesheet, a JSON payload or an email. A data URL wraps that string with a prefix such as data:image/png;base64, which tells the browser what kind of file it is decoding.

No. Paste either the full data URL or the raw base64 string on its own. If the prefix is missing, the format is detected from the first few decoded bytes — PNG, JPEG, GIF, WEBP, BMP and SVG all have recognisable signatures.

Three usual causes. Whitespace and line breaks copied in from a code editor, which are stripped automatically here. URL-safe base64, which uses hyphen and underscore where standard base64 uses plus and slash — also handled. Or a truncated string, where the copy simply stopped short. If it still fails, the string is incomplete.

About 33% larger, because every three bytes become four characters. That overhead is the price of being text-safe, and it is why embedding large photographs as base64 is a bad idea for page weight.

No. Decoding happens entirely in your browser. That matters here more than usual — base64 blobs often come out of API responses and config files that may contain things you would rather not paste into a remote server.

Yes, the base64 image encoder turns a file into a data URL, CSS background rule or img tag.