Base64 to Image Converter - Free Online Decoder

Base64 to Image

Paste a Base64 encoded string below to convert it into a downloadable image.

0 Characters

Base64 to image is a free online decoder that turns a Base64 string or data URI into a picture you can preview and save. Paste the text, click Convert to Image, check the detected format, dimensions and file size, then download the file. It suits developers, testers and anyone who finds an image buried in text.

What Is a Base64 Image String?

A Base64 image string is a picture written as plain text, using only letters, numbers, plus signs, slashes and equals signs. Base64 is an encoding scheme that represents binary data (the bytes of a PNG or JPEG file) with 64 safe text characters, so the image can travel inside JSON, HTML, CSS, email or a database field.

Every 3 bytes of image data become 4 characters of text, so the encoded version is roughly one third larger than the original file. That overhead is the price of keeping an image inside a text format.

Raw Base64 vs. a data URI

You will meet the same image in two shapes. Raw Base64 is just the encoded characters, such as iVBORw0KGgoAAAANSUhEUgAA.... A data URI wraps those characters with a label that tells a browser what they are, such as data:image/png;base64,iVBORw0KGgo.... The converter accepts either shape, which is why the input hint shows both examples.

How can you tell the format from the first characters?

The first characters of the encoded text come from the file header, so they reveal the image type. These beginnings are well established:

Starts withFormatTypical use
iVBORw0KGgoPNGLogos, screenshots
/9j/JPEGPhotos
R0lGODGIFSimple animations
QkBMPUncompressed bitmaps
UklGRWebPWeb-optimized images

How to Use the Base64 to Image Converter

You can decode a string in under a minute. Follow these steps:

  1. Copy the Base64 text from your API response, HTML file, CSS rule, database or email source.
  2. Click Paste to drop it in from your clipboard, or paste it straight into the Base64 String box. The character counter above the box confirms how much text arrived.
  3. Click Convert to Image. If you only want to see how the tool behaves, click Sample first to load a ready-made example.
  4. Look at the Format, Dimensions and File Size values, then check the picture under Image Preview.
  5. Click Download Image to save the decoded file. Use Copy Base64 if you need the encoded text again.
  6. Click Reset to clear the box and start with another string.

Worked Example: Decoding a Base64 String

Say a teammate sends you a JSON response containing a field that begins with iVBORw0KGgoAAAANSUhEUgAA and runs for 4,000 characters. You copy only the value, without the surrounding quotes, and paste it into the box.

The text starts with the PNG signature, so the tool reports the format as PNG. The string has 4,000 characters and no padding, so it decodes to about 3,000 bytes (4,000 x 3 / 4), and the File Size field shows roughly 2.9 KB. Dimensions appear next to it, for example 120 x 120 pixels, and the preview shows the actual picture.

What this tells you: the string is a small, valid PNG, probably an icon or a thumbnail. A 3 KB image is a sensible candidate for inlining. If the same field held 400,000 characters, you would see a file near 300 KB, and that is usually a sign the image should be a normal file instead.

How to Read and Act on the Results

The result panel gives you three facts and a preview, and each one points to a next step.

Format

The format label tells you what kind of file you will download. If it says PNG for something that should be a photo, the source may have stored a lossless version, which is a hint to convert it. If the label says Unknown, the text may be damaged, truncated or not an image at all.

Dimensions

Dimensions are the width and height in pixels. Compare them with the space where the image will appear. A 2000 x 2000 image shown in a 100-pixel slot wastes bandwidth, so run it through an image resizer before reuse.

File Size

File size is the size of the decoded file, not the length of your text. Expect the pasted text to be about 33% longer than this number. As a widely used rule of thumb, Base64 works well for small assets such as icons and tiny logos, and gets wasteful for large photos. If the decoded file is bigger than you want, try an image compressor before encoding it again.

Preview

The preview is your proof that the data is a real image. If the picture looks cut off at the bottom, the string was probably truncated when it was copied. If it looks right, download it and use it like any other file.

How Do You Convert Base64 to an Image in Code?

In JavaScript, React, HTML, Python, C#, n8n or Power Automate, the idea is the same: either decode the characters back into bytes and save them as a file, or build a data URI and use it where an image address would go. In HTML, you set the image source to the full data URI, including the data:image/png;base64, prefix.

This page is the fast way to check your input before you write that code. If the preview works here, the string is valid and the bug lives in your code, usually a missing prefix, a wrong content type or stray characters. To go the other direction and produce a string from a file, use the Image to Base64 converter.

Who Uses a Base64 Image Decoder?

  • Front-end developers inspect inline images in CSS or HTML and pull them out as real files.
  • API testers verify that an endpoint returns a valid image in a JSON field, such as a QR code, signature or avatar.
  • Automation builders check a Base64 value coming out of a workflow before they attach it to an email or upload it.
  • Support and QA teams open screenshots that a bug report stored as long text.
  • SEO and performance analysts find oversized inline images that bloat a page, then replace them with compressed files. The Image Editing and Optimization tools cover the next steps.

Best Practices and Troubleshooting Tips

Most failed conversions come from small input mistakes, and each has a quick fix.

Copy the value only

If you copy from JSON or source code, leave out the quotation marks, commas and field names. A leading quote or a trailing semicolon turns valid data into an error.

Remove escaped characters

Text taken from logs or JSON often contains escaped line breaks such as \n or escaped slashes. Replace them with nothing (or a plain slash) before pasting.

Check for truncation

Terminals, spreadsheets and some chat apps cut long strings. Compare the character counter with the length you expect. A string that ends abruptly will not give a full image.

Keep the prefix consistent

Both data:image/png;base64, strings and raw Base64 work. Do not paste half a prefix, and do not paste a prefix twice.

Test with the sample first

If you are unsure whether the problem is your data or your workflow, click Sample. A working sample proves the page is fine, so the issue is in your string.

Need text from the picture?

If the decoded image is a scan or screenshot and you want the words in it, send it through an image to text OCR tool.

Limitations to Know About

The tool decodes image data. It cannot repair a corrupted string, guess missing characters or turn a PDF, audio clip or other file type into a picture. Format detection reads the start of the data, so an unusual or unlabeled format may show as Unknown. Very long strings take longer to paste and display, and your device's memory is the practical limit, so for huge images a normal file workflow is a better fit. When you need a dummy graphic for a layout test rather than a decode, a placeholder image generator is quicker.

Paste your Base64 text into the box above, click Convert to Image, and you will know in seconds whether the string is a valid picture, what format and size it has, and have the file ready to download.

Frequently Asked Questions

How do I convert Base64 to an image online?
Paste your Base64 string into the Base64 String box and click Convert to Image. The tool shows a preview with the format, dimensions and file size. Then click Download Image to save the file. The Sample button loads an example if you want to test it first.
What is a Base64 encoded image?
A Base64 encoded image is a picture stored as plain text instead of a file. Every 3 bytes of image data become 4 characters, so the text runs about 33 percent larger than the original. Developers use it to embed small images in HTML, CSS or JSON.
Can I paste a data URI instead of raw Base64?
Yes, the converter accepts both raw Base64 and full data URIs that start with data:image/png;base64, or a similar prefix. Paste whichever you have. If one fails, make sure you copied the whole value with no quotes, commas or line breaks.
Why does my Base64 string show an error or a broken preview?
Most errors come from truncated text, extra quotation marks, escaped characters such as backslash n, or data that is not an image. Compare the character count with the length you expect, clean the string, and try again. The Sample button confirms the tool itself works.
Why is the file size smaller than my Base64 text length?
The File Size value shows the decoded image, while your text is the encoded version, which is about one third longer. For example, 4,000 Base64 characters decode to roughly 3,000 bytes, or about 2.9 KB. The difference is normal Base64 overhead.
Is the Base64 to Image tool free, and which formats does it detect?
The Base64 to Image tool is free and needs no sign-in. It identifies PNG, JPEG, GIF, BMP and WebP images from the start of the data and shows the format, dimensions and file size. Anything it cannot recognize is labeled Unknown.
Recommended

Explore VPN options

A VPN changes your network exit. It does not guarantee anonymity.

Hide Your IP Encryption Network coverage
Protect My IP Now