Base64 to Image

Free Base64 to image converter — paste a Base64 string or a data URI, see the picture, and download the original file back. PNG, JPG, GIF, WebP, SVG and more.

Instant Preview
Right Extension, Always
Nothing Leaves Your Device
Base64 String
Ctrl + Enter to convert

A bare string and a full base64 image URL both work. Quotes, src= wrappers, line breaks, URL-safe - and _, and missing = padding are all repaired for you.

Image Preview

Your image appears here

Paste a string and press Convert

Format
Dimensions
File Size
Base64 Chars

No sign-up, no watermark, no limit on how many you convert.

How to convert Base64 to an image online

Paste your base64 image data in, press the button, get the picture out. The whole base64 decode to image online step happens in this page — the string never leaves your device, so there is no upload wait and no file sitting on somebody else's server. Three steps:

  1. Paste the string. A bare base64 string to image online conversion works, and so does a full data URI starting data:image/png;base64,. Sample loads a real base64 image string example if you just want to see the tool work.
  2. Press Convert. The bytes are decoded and the picture appears immediately, with its format, dimensions and file size beside it.
  3. Download or copy. Download saves the file in whatever format it was encoded from — a PNG string gives a .png, a JPEG string a .jpg. This decodes rather than converts, so the file is identical to the original; to change the format afterwards, use the Image Format Converter — that is the whole of how to download Base64 image files, with no account and no waiting. The copy buttons give you an <img> tag, a CSS background-image, or the raw data URI.

The format comes from the bytes, not the header

Most converters trust the base64 image header — the data:image/png part — and name the download after it. That header is just text somebody typed, and it is wrong surprisingly often. A string labelled image/png whose bytes are actually JPEG will download as a .png that no viewer opens.

This page reads the file signature instead: the first few bytes of every image format are fixed, so the real type is knowable with certainty. If the header and the bytes disagree, the tool says so and uses the bytes. That is also why the base64 image extension on your download is always the right one.

Base64 starts withReal formatMIME type
iVBORw0KGgoPNGimage/png
/9j/JPEGimage/jpeg
R0lGODlhGIFimage/gif
UklGRWebPimage/webp
QkBMPimage/bmp
PHN2Zy or PD94bWwSVGimage/svg+xml
AAABAAICOimage/x-icon
SUkq or TU0ATIFFimage/tiff

Handy on its own: you can tell what a string contains just by looking at the first few characters, before decoding anything. That is what the base64 image mime type really is — a label, whereas the signature is the truth. BMP gets only two characters because its third one encodes part of the file size, so it lands on Qk0, Qk1, Qk2 or Qk3 depending on the file.

Reading a Base64 image without downloading it

Most of the time nobody wants a file at all — they want to know what a string is. A blob of Base64 turns up in an API response, a log line or a database column, and the only question is whether it really is the picture it claims to be — the base64 image meaning is never visible in the string, so you have to look. That makes this a base64 image reader first and a converter second: the base64 to image preview appears the moment you press Convert, and nothing is written to disk unless you ask for it.

A preview also answers questions a file listing cannot. The chequerboard behind the image shows whether the transparency survived. The dimensions confirm you have the full-size version rather than a thumbnail. Used that way, as a base64 image visualizer, it takes a couple of seconds to rule out the one thing that is hardest to debug blind: a string that decodes perfectly and simply contains the wrong picture.

Two places these strings turn up more than anywhere else. A base64 image email signature inlines a logo so it renders without the recipient having to load remote content — which many mail clients block by default. And exports from a base64 image editor or a canvas-based app hand you a data URI rather than a file, because the browser had nowhere to put a file. Both arrive as text, and both need turning back into an image before anyone can check them.

Adding a Base64 image to HTML and CSS

To add a base64 image to HTML, put the data URI in the src attribute. The Copy as <img> button writes that base64 image html code for you, so the base64 to image src value is already escaped and complete:

  • HTML<img src="data:image/png;base64,iVBORw0KGgo…">
  • CSSbackground-image: url("data:image/png;base64,…");
  • Markdown![alt](data:image/png;base64,…)

Inlining suits small graphics: an icon, a logo, a base64 image with transparent background that has to sit inside a single self-contained file. It suits photographs badly. The encoded text is about a third larger than the file, it cannot be cached separately from the page, and the whole thing is re-downloaded every time that page changes. As a rough line, inline under 5 KB and link to anything bigger.

Why a string sometimes will not decode

Base64 is unforgiving about length: it comes in blocks of four characters, so if one is missing the whole tail fails. The usual causes are a copy that stopped short, a line-wrapped string that lost its ends, or extra characters picked up from the surrounding code. This page repairs the harmless cases automatically — surrounding quotes, src= prefixes, whitespace, URL-safe - and _, and missing = padding — and tells you specifically what is wrong when it cannot.

One case that is not an error at all: valid Base64 that simply is not a picture. If you paste an encoded sentence, the tool decodes it and says it found text, because a base64 image to text mix-up is far more common than a corrupt image. Use the Base64 decoder for text and the Image to Base64 encoder to go the other way — that is the base64 image encoder online half of the pair, and between them they cover both directions.

What Base64 does and does not cost you

Decoding is lossless. Base64 is an encoding rather than a compression, so the image you download is byte-for-byte the file that was encoded — there is no base64 image quality loss to worry about, at any size. What it does cost is bytes: four characters for every three, which is about 33% larger. Any base64 image size calculator is just doing that multiplication, and the Base64 Chars figure above shows both numbers side by side so you can see it.

There is no base64 image max length in the format itself. The limits come from whatever carries the string: a URL length cap, a database column, or an email client that quietly refuses a very large inline image. If the goal is a smaller file rather than a different encoding, the Image Compressor is the right tool, and the full story is in What Is Base64? And Why It Is Not Encryption.

Frequently Asked Questions

Paste the Base64 string into the box and press Convert. The string is decoded in your browser, the image appears straight away, and the Download button saves it with the correct extension. You can paste a bare Base64 string or a full data URI beginning with data:image/png;base64, — both work.
PNG, JPEG, GIF, WebP, BMP, SVG, ICO, TIFF, AVIF and HEIC. The format is worked out from the decoded bytes rather than from the data URI header, so a string labelled image/png that actually contains JPEG bytes is still saved as a .jpg that opens properly.
Almost always because part of it is missing or something extra was copied with it. Base64 uses only A–Z, a–z, 0–9, plus and slash, with equals signs for padding, and its length is always a multiple of four. Quotes, src= wrappers, line breaks and URL-safe dashes and underscores are all repaired automatically, so an error usually means the string itself was cut short.
Yes. The preview is the point: paste the string and look at the picture. Nothing is saved unless you press Download, and nothing is sent anywhere at all, so it works as a quick Base64 image viewer for checking that a string in a log file or an API response really is the image you expected.
Use a data URI as the src attribute: <img src="data:image/png;base64,iVBORw0KGgo…">. The Copy as img tag button builds that for you, and Copy as CSS gives the background-image form instead. Inlining works best for small graphics such as icons; a large photo inlined this way makes the page heavier and cannot be cached separately from it.
No. Base64 is an encoding, not a compression, so decoding returns the exact bytes that were encoded. The image you download is identical to the original file, pixel for pixel. What Base64 does cost is size: the encoded text is about 33% larger than the file it represents.
This page accepts strings up to about 12 MB of text, which is roughly a 9 MB image. The format itself has no limit; the practical ones come from whatever carries the string, such as a URL length cap, a database column, or an email client that refuses very large inline images.
No. The string is decoded by your own browser and the preview is built from the decoded bytes in memory. Nothing is uploaded, nothing is stored, and closing the tab discards everything.