How to Convert Base64 to Image
To convert Base64 to image, paste the encoded text into the left box. The tool removes any data URI prefix, decodes the characters back into bytes, works out what kind of image those bytes are and draws it on the right. A tiny PNG, for example, is this much text:
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGNg+M/A8B8ABQACAam5sAAAAABJRU5ErkJggg==Pasted into the tool, it is recognised as a PNG of 70 bytes. Everything happens on your device, so it works for private images too.
What You Can Paste
The tool accepts the forms that Base64 images usually come in, so you do not have to trim them by hand:
- Bare Base64, such as the string above.
- A data URI:
data:image/png;base64,iVBORw0KGgo.... - A CSS rule such as
background-image: url("data:image/png;base64,...");. The tool finds the data URI inside it. - An HTML tag such as
<img src="data:image/png;base64,...">or a Markdown image. - Text with line breaks or spaces in it, which is common when Base64 comes from an email or a certificate-style file.
- URL-safe Base64, which uses
-and_instead of+and/, with or without the = padding.
When the tool changes anything to make the text readable, it tells you under the picture, so you know what was fixed.
How the Tool Knows the Image Type
A data URI says what the image is, for example image/png, but that label is just text and can be wrong. This tool looks at the first bytes of the decoded data instead. A PNG always starts with the same eight bytes, which is why Base64 PNGs begin with iVBORw0KGgo. JPEG, GIF, WebP, AVIF, BMP and ICO files have their own signatures, and SVG is recognised by its opening tag.
If the label and the data disagree, the data wins. The tool shows a note, and the downloaded file gets the extension that matches what is really inside. When the first bytes are not a known image format, the tool falls back to the type in the data URI, if there is one, and otherwise refuses.
Common Errors and What They Mean
- Not a valid length: Base64 text cannot have a length that leaves one character over when divided by four. This almost always means the text was cut off when it was copied.
- A character that is not Base64: letters, digits, plus, slash and equals are allowed. A stray quote, comma or other symbol breaks it. The error shows the character and its position.
- An equals sign in the middle: the padding sign can only be at the end.
- Valid Base64, but not an image: the text decodes fine, yet the result is not a known image format. It may be plain text, a PDF or a zip file. For a PDF, use Base64 to PDF. For plain text, use Base64 Decode.
- The browser could not draw it: the bytes start like an image but the rest is missing or damaged. Copy the full string again.
Base64 to PNG, JPG, GIF, WebP or SVG
The tool does not convert between formats. A Base64 PNG gives you a PNG file, and a Base64 JPEG gives you a JPG file. That keeps the image exactly as it was encoded, with no loss of quality. If you need another format afterwards, an SVG can be turned into a PNG with SVG to PNG.
Large images produce very long text. The tool accepts up to about 6 MB of image data. If a huge string makes your editor slow, copying it straight from the source into this tool is usually easier than opening it in a text editor first.
Go the Other Way: Image to Base64
To turn a file into Base64, use Image to Base64. It gives you a data URI or a CSS, HTML or Markdown snippet and shows how much larger the text is than the file. Pictures from a phone or camera can carry location details, so you can check them first with the EXIF Remover.
Safety When You Open Unknown Base64
The preview is shown as a plain image, so scripts inside an SVG are not run. Still, think about where the text came from. An image can be offensive or misleading, and the tool only decodes and displays it. It does not check whether an image is safe or genuine.
Your Text Stays in Your Browser
Decoding is done by code running in your browser tab. The text and the image are not sent to a server and are not stored. Reloading the page removes them. See the Privacy Policy for details.