Base64 to Image

Käännä Base64-merkkijono takaisin katseltavaksi kuvaksi, esikatsele selaimessa ja lataa tiedosto alkuperäisessä kuvamuodossa.

Decoding a Base64 string back into an image

Paste a Base64-encoded image string - with or without the data:image/...;base64, prefix - and this tool decodes it and displays the resulting image, with a download link. Everything happens locally in your browser; the string you paste is never sent anywhere.

How this differs from this site's Image to Base64 tool

This tool performs the reverse operation of the Image to Base64 converter - that one takes a real image file and encodes it into a Base64 text string, while this one takes a Base64 text string and decodes it back into a viewable, downloadable image. Together they cover both directions of the same conversion.

Why the data: prefix matters for correct decoding

The data:image/png;base64, (or similar) prefix tells the browser what image format the following data represents - without it, the browser has to guess, which is why this tool defaults to assuming PNG when no prefix is present. If your actual image is a JPEG or another format, adding the correct prefix yourself ensures it decodes and displays correctly.

Why this is commonly needed when working with APIs and databases

Many APIs, databases, and data-exchange formats embed images as Base64 text rather than binary files, since text-based formats like JSON can't natively carry binary data - being able to quickly decode a Base64 string pulled from an API response or database field, without writing a script, is a common practical need for anyone debugging or inspecting that kind of data.

Where Base64 image strings usually come from

Most Base64 image strings you will need to decode come from one of a few places: an API response that returns a picture inside a JSON field, a data URL copied out of a stylesheet or HTML source, an email template that embeds its logo inline, a canvas element exported by a script, or a database column that stores small images as text. Knowing the source also tells you what to expect - screenshots from a canvas are normally PNG, while photos from a camera upload are usually JPEG.

Cleaning the string before you paste it

A string copied out of source code or JSON often carries extra characters that are not part of the image data: surrounding quotation marks, escaped slashes written with a backslash, line breaks inserted by a text editor, or a trailing comma. Remove those first and paste only the characters between the quotes. Stray whitespace or a truncated copy are the two most common reasons a valid-looking string fails to display.

Troubleshooting a broken or blank result

If nothing appears, check three things in order. First, make sure the whole string was copied, since a Base64 image cut off partway through cannot be rebuilt. Second, check the format prefix - a JPEG decoded as PNG may fail to render, so add the correct data:image prefix for your file type. Third, confirm the string really is an image; Base64 is also used for PDFs, fonts and plain text, none of which will show up as a picture.

Usein kysytyt kysymykset

What if I do not know the image format?

If your string does not include the data: prefix, this tool assumes PNG by default. If the image fails to display, try adding the correct prefix for your format (e.g. data:image/jpeg;base64, for a JPEG).

Is there a size limit?

Very large Base64 strings may be slow to process in the browser, but there is no hard limit enforced by this tool itself.

How is this different from the Image to Base64 tool?

That tool converts an actual image file into a Base64 text string. This tool does the reverse - taking a Base64 string and decoding it back into a viewable, downloadable image.

Why would a Base64 image string need decoding at all?

Many APIs, databases, and data formats like JSON embed images as Base64 text rather than binary files, since text-based formats can't natively carry binary data - decoding lets you actually view that embedded image.

Is my pasted Base64 string sent to a server?

No - decoding happens entirely in your browser using built-in image-rendering capability. Nothing you paste here is transmitted anywhere.

Why does my decoded image show as broken?

The usual causes are a truncated copy of the string, extra characters such as quotes or line breaks, or a wrong format prefix. Paste only the raw Base64 characters and, if the image is not a PNG, add the matching data:image prefix.

Can I decode a Base64 string that is not an image?

This tool is built for images, so a Base64 string that represents a PDF, a font or plain text will not display here. For plain text, the Base64 Converter on this site decodes it directly.

Lisää kategoriassa Image Tools