Base64 To Image

Decode a base64 string back into a viewable, downloadable image file. Paste, decode, download. No signup. Ideal for developers working with encoded images in code and data.

Remove Ads
Remove Ads
Remove Ads

Share on Social Media:

A base64 to image decoder turns an encoded text string back into a picture you can see and save — free, with no account. Paste a data URI or a raw base64 string, preview the image to confirm it is the right one, and download it as an ordinary image file. Everything runs in your browser: nothing is uploaded or stored.

On this page

  1. How to Decode Base64 to an Image Step by Step
  2. What Base64 Is and Why Images Get Encoded
  3. Base64 Images Versus Linked Image Files
  4. Who Uses a Base64 to Image Decoder
  5. Pro Tips for Working With Base64 Images
  6. Common Base64 Image Mistakes to Avoid
  7. Related Tools You May Need Next
  8. Frequently Asked Questions

How to Decode Base64 to an Image Step by Step

  1. Paste the base64 string. Drop it into the input box — either a full data URI starting with data:image/...;base64, or the raw base64 characters on their own.
  2. Click Preview Image. The tool decodes the string and shows the image, so you can confirm it is the correct picture and that the base64 was valid and complete.
  3. Check the preview. If the string is not valid image data, no preview is shown.
  4. Download the image. Click Download Image to save it as a file. It is always named image.png, whatever the image's real format — rename it to .jpg afterwards if the image is a JPEG.
  5. Use the file as an ordinary image. View it, store it or attach it, rather than carrying it around as an encoded string.

Flat illustration of base64 code text converting to a photo

What Base64 Is and Why Images Get Encoded

Base64 is a way of representing binary data, like an image, using only text characters. It encodes bytes into a set of sixty-four safe characters — letters, digits and a couple of symbols — so that data which is naturally binary can be embedded in text-based formats. This is why base64 is everywhere in web development: it lets binary content travel through systems that expect text, such as JSON, HTML, CSS and email.

Images get encoded to base64 for specific reasons. Embedding an image directly in code as a base64 string means it travels with the code, avoiding a separate file and an extra request to fetch it. Small images, icons and logos are sometimes embedded this way in HTML or CSS so they load with the page. Images in JSON data or email attachments are base64 encoded because those formats carry text, not raw binary. Decoding reverses this to get the usable image back.

The string you paste comes in two forms, and the tool treats them differently. A full data URI — data:image/png;base64,... — is used exactly as it is, so any format works as long as its prefix names it: data:image/jpeg;base64,... for a JPEG, data:image/gif;base64,... for a GIF. Raw base64, with no prefix, gets data:image/png;base64, added by the tool — but the browser reads the image's actual bytes to work out its format, so a raw JPEG, GIF or WebP string still previews and downloads correctly. The prefix is only a label; the browser decodes by content, not by the name in the prefix.

Worked example — paste this 118-character data URI of a 1×1 red PNG:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==

The preview shows a single red pixel, and Download Image saves it as image.png — 70 bytes, the exact original file. Pasting only the 96 base64 characters after the comma gives the same result, because the tool adds the PNG prefix for raw input itself.

Decoding is lossless. A base64 string is about a third larger than the original binary image, the cost of representing binary as text, but decoding gives back the exact original image with no quality change. The encoding and decoding only change how the data is represented, not the data itself — which is why an image can be encoded to base64 and back many times with no degradation, unlike lossy image compression.

The download is always called image.png. That is the file's name, not its format: a decoded JPEG downloads with its JPEG bytes intact but a .png name. Rename it to .jpg after downloading, or some programs will refuse to open it.

Base64 Images Versus Linked Image Files

AspectBase64 embedded imageLinked image file
Extra requestNone — travels with the codeOne request to fetch the file
SizeAbout a third larger as textOriginal binary size
CachingNot cached separatelyBrowser can cache it
Best forSmall icons and logos in codeLarger images and photos
FormData URI in HTML or CSSA URL in an img src

Decoding is the right move when you have been handed the encoded form and need the real file back: an image embedded in a page you are rebuilding, a picture stored in JSON or a database field, or an attachment that arrived as base64 text. Once decoded, the image is an ordinary file again — link it, edit it or store it like any other.

Who Uses a Base64 to Image Decoder

Developers recovering images from code and data. A developer finds a data URI in source code or a JSON payload and decodes it to get the original image file back for reuse or inspection.

Email developers extracting embedded images. An email developer pulls an image out of a message or template where it was embedded as base64, to save it as a normal file.

QA testers checking encoded assets. A tester decodes the base64 an app produces to confirm the image it represents is the right one, at the right size and in the right format.

Designers pulling an image out of a single-file page. A designer opens a self-contained HTML file, copies an embedded data URI, and decodes it to recover the image as a file they can edit.

Anyone handed a base64 string instead of a file. A person who receives an image as a wall of text — in a chat message, a document or a ticket — decodes it to see the picture and save it.

Laptop showing base64 text converting to a mountain photo

Pro Tips for Working With Base64 Images

Paste the full data URI when you have it. The prefix names the format, so JPEG, GIF, PNG and WebP all decode correctly. Raw base64 works too — the tool adds the PNG prefix and the browser reads the image's actual bytes — but the full data URI is clearer for anyone reading the string.

Raw input works for any format, not just PNG. The tool adds the PNG prefix to raw base64, but the browser reads the image's actual bytes, so a raw JPEG, GIF or WebP string still previews correctly. The full data URI is still the clearest form to paste, because its prefix names the format.

Check the preview before downloading. The preview is your proof the string was complete and valid. A broken or truncated string shows an error instead of an image — do not download what you have not seen.

Rename image.png to .jpg when the image is a JPEG. The download name never changes, but the bytes do not either. Rename the file to match its real format after downloading.

Strip line breaks from copied strings. Raw input has whitespace removed automatically, but a data URI is used verbatim — a line break inside it can break the decode. Paste it as one unbroken line.

Spot-check with the PNG signature. A PNG's base64 almost always starts with iVBORw0KGgo — the same characters as the placeholder in the input box. If your string starts that way, it is a PNG and raw input will work.

Common Base64 Image Mistakes to Avoid

Pasting text that is not base64 at all. A URL, a file path or plain words are not image data. The preview cannot decode them, so no preview appears. Paste the base64 string itself, not the address of the image.

Downloading a JPEG and wondering why it is called image.png. The download is always named image.png, whatever the format. The contents are still JPEG — rename the file after downloading.

Pasting a truncated string. One missing character breaks the image. Copy the full string, end included, and check the preview appears before trusting the download.

Pasting a data URI with line breaks in it. Some editors wrap long strings across lines. Raw input survives that — whitespace is stripped — but a data URI does not, so join it into one line first.

Expecting format or size details. The tool shows only the preview and a download link — no format, dimensions or file size. Open the downloaded file to check those.

Assuming the download converts the format. It does not. The downloaded bytes are the original image, unchanged — a JPEG stays a JPEG, whatever the .png filename suggests.

Related Tools You May Need Next

Image to Base64. Encode an image back into base64.

Base64 Encode Decode. Base64 on text rather than images.

Text to Hex. Convert between text and hex.

JPG Converter. Change image formats.

PNG to JPG. Change image formats.

Image Compressor. Shrink an image.

3D illustration of encoded text converting to a photo

Frequently Asked Questions

How do I convert base64 to an image?

Paste the base64 string — a full data URI or raw base64 — into the box and click Preview Image. The decoded picture appears; click Download Image to save it as a file.

What is the difference between a data URI and raw base64?

A data URI is the base64 string with a prefix naming the format, such as data:image/png;base64,. Raw base64 is just the encoded characters with no prefix. This tool accepts both, but raw input is always assumed to be a PNG.

Can I decode a JPEG, or only PNG?

Both. A JPEG works either way: paste it as a full data URI with the data:image/jpeg;base64, prefix, or paste the raw base64 on its own. Raw input gets the PNG prefix added by the tool, but the browser reads the image's actual bytes, so the JPEG still previews and downloads correctly.

Why does it say "Invalid Base64 image"?

The string is not decodable image data. The usual causes are a truncated string, or text that is not base64 at all. Check the string is complete and that you pasted the base64 itself, not a URL or a file path.

Why is the downloaded file always called image.png?

The download link is fixed to the name image.png, whatever the image's real format. The file's contents are unchanged — a JPEG downloads as JPEG bytes with a .png name — so rename it to .jpg after downloading if the image is a JPEG.

Does decoding change the image quality?

No. Base64 is a lossless encoding: decoding returns the exact original bytes, with no quality change and no recompression. The image you download is byte-identical to the one that was encoded.

How do I know if my string is a PNG?

A PNG's base64 almost always starts with iVBORw0KGgo — the same characters shown in the input box's placeholder. If your string starts that way, it is a PNG and raw input will work.

Can I decode a base64 string with line breaks in it?

For raw base64, yes — the tool strips all whitespace before decoding. For a full data URI, no — the URI is used exactly as pasted, so join it into one unbroken line first.

What if the string is very long?

Long strings are normal: base64 is about a third larger than the image, so even a small picture becomes a long wall of text. Paste it all — a truncated string is the most common reason decoding fails.

Is the base64 to image decoder free?

Yes, it is completely free with no account and no usage limit. It runs entirely in your browser, so your base64 string and image are never uploaded or stored.