Image converter · Free · No upload
Base64 to Image Converter
To convert Base64 to an image, paste the string, with or without the data:image prefix, and the picture appears with its real format and pixel size, ready to download. The format is read from the decoded bytes, not the label. A string that fails is explained, and everything is decoded in your browser, never uploaded.
Paste the string, then save the image.
| Measure | Value |
|---|
The string is decoded in this browser and never uploaded; it is not kept either, only your file name and choices are. The picture is shown through an image element, so an SVG cannot run a script here. To change the pixel size of what you decoded, use the image resizer; to turn text into its bytes in hex, binary and Base64, use the ASCII, hex, binary, decimal converter.
Paste a Base64 string, or a whole data URL, <img> tag or CSS rule that contains one. The image is drawn at once, with its format found from the bytes and its size in pixels; if the string is damaged, the page says exactly what is wrong. Then download the picture, or copy it back out as a data URL, an <img> tag or CSS.
A Base64 image is a picture file written as text: every 3 bytes of the file become 4 characters, so it can sit inside a web page, a stylesheet or a JSON message. Decoding turns the text back into the original bytes.
- No sign-up
- Nothing uploaded
- Finds the real format
- Explains a failed string
- Works offline
Key facts
| Detail | Answer |
|---|---|
| Input | A Base64 string, a data URL, an <img> tag or CSS url() holding one, or a text file |
| Formats found | PNG, JPEG, GIF, WebP, BMP, ICO, SVG, AVIF, HEIC, TIFF |
| Save as | The original, or PNG, JPEG or WebP, if your browser can write it |
| Size limit | 30 million characters, refused with a message |
| Size cost of Base64 | About a third larger than the file |
| Where your string goes | Nowhere: it is decoded in this browser and not kept |
How to convert Base64 to an image
Paste the string, check the preview, then save the picture.
Paste the string
A bare Base64 string or a whole data:image/…;base64,… URL both work.
Read the report
The format found from the bytes, the pixel size, the decoded size and the alphabet.
Fix it if it is refused
The message gives the cause: a character and where it is, or a cut-off string.
Choose how to save
The original format, or PNG, JPEG or WebP, under a file name you set.
Download or copy
Save the file, or copy a data URL, an img tag or a CSS background.
Who uses a Base64 to image converter
Anyone who has a picture as a long string of text and needs to see it or turn it back into a file.
Web developers
Checking what an embedded data URL really contains.
API and database users
Viewing an image field returned as Base64 in JSON.
Email and HTML authors
Pulling an inline image out of a message or template.
Designers
Saving an icon from a stylesheet as a file.
QA and support staff
Finding out why a string will not display.
Students
Seeing how bytes, Base64 and a picture relate.
Which image format a Base64 string is, by its first letters
Every image file starts with a few fixed bytes that say what it is, and those bytes become fixed letters at the front of the Base64 string. That is how this page knows the format with no file name and no data URL label, and how you can tell by eye. The signatures below are the ones the tool checks.
| Format | String starts with | First bytes (hex) | MIME type |
|---|---|---|---|
| PNG | iVBORw0KGgo | 89 50 4E 47 0D 0A 1A 0A | image/png |
| JPEG | /9j/ | FF D8 FF | image/jpeg |
| GIF | R0lGOD | 47 49 46 38 (“GIF8”) | image/gif |
| WebP | UklGR | 52 49 46 46 (“RIFF”), then “WEBP” | image/webp |
| BMP | Qk | 42 4D (“BM”) | image/bmp |
| ICO | AAABAA | 00 00 01 00 | image/x-icon |
| SVG | PHN2Zy or PD94bW | “<svg” or “<?xml” as text | image/svg+xml |
Two cautions. UklGR is the start of any RIFF file, and a WAV sound or an AVI video begins the same way, so the tool reads the four letters after it to tell WebP from them. And the start only says what the file claims to be: it does not prove the rest is intact, which is why a string can be recognised as a PNG and still fail to draw. AVIF, HEIC and TIFF are recognised from their own signatures too, though most browsers cannot draw HEIC or TIFF; MDN’s image format guide lists which browsers support which.
Why a Base64 string will not turn into an image
Most “Base64 image not showing” problems come down to one of a handful of causes, and the tool names the one it finds instead of saying only that the input is invalid.
| What you see | What is wrong | The fix |
|---|---|---|
| “Not valid in Base64” at a position | A character outside A–Z, a–z, 0–9, + and / slipped in: a quote, a comma, a stray letter from the surrounding code | Delete that character, or paste the whole data URL and let the tool cut it out |
| A length with 1 left over | Every 4 characters make 3 bytes, so a length of 4n + 1 is impossible: characters were lost | Copy the string again from its source; it was cut off |
| An = in the middle | = only pads the very end, so two strings were joined or text was pasted inside one | Split them and decode each on its own |
| Valid, but “not an image” | It decodes to a PDF, a ZIP, text or another file, not a picture | Save it with the right extension, or check what produced the string |
| Recognised, but no preview | The bytes start like a PNG or JPEG but the ending is missing (a truncated string), or the format is one browsers cannot draw | Copy the string in full; for HEIC or TIFF save the file and open it in a program |
| The data URL has no ;base64 | Its data is plain or percent-encoded text, not Base64 | Only data URLs marked ;base64 are decoded here |
Three things are forgiven rather than refused, because they are formatting and not damage: line breaks and spaces anywhere in the string, a missing = at the end (it is added, and the report says so), and the URL-safe alphabet that writes - and _ in place of + and /, which RFC 4648 defines for use in URLs and file names. A percent-encoded string (%2B for +) is decoded first.
Data URL, img tag or CSS: embedding a Base64 image
A data URL carries the file inside the address. Its form, as MDN describes the data: scheme, is data:[<media-type>][;base64],<data>. The media type is optional and defaults to text/plain, and ;base64 marks the data as Base64. So the same picture can be written three ways, and the tool shows whichever you choose, built from the real type it found in the bytes.
| Form | Where it goes | Starts |
|---|---|---|
| Data URL | Any place that takes an address | data:image/png;base64,iVBORw0KGgo… |
| HTML <img> | A web page, with width and height filled in | <img src="data:image/png;base64,…" width="12" height="12"> |
| CSS background | A stylesheet | background-image: url("data:image/png;base64,…"); |
Embedding is for small things. Base64 writes every 3 bytes as 4 characters, so the string is about a third longer than the file, it cannot be cached apart from the page that holds it, and a large one slows that page. A small icon in a stylesheet is a reasonable use; a photograph is not. Browsers also block opening a data: URL as the address of a page, so one pasted into the address bar will not display, which is why this page draws it for you.
Nothing uploaded, and what to be careful of
Decoding runs here, and the picture is drawn as an image, never as a page. The string is turned into bytes by your browser and shown through an image element, which does not run scripts, so an SVG that carries one is drawn but cannot act. It is not sent to any server and it is not stored: reload the page and the box is empty, with only your file name and choices remembered.
Be careful with strings from a source you do not trust all the same. This page will not run an SVG’s script, but if you save an SVG and open it as a page in a browser, or paste it into a site that inlines it, that is a different situation, and one this tool cannot protect you from. A string that decodes to a PDF or an archive is reported as that and never opened.
And Base64 is an encoding, not a lock. Anyone can turn the string back into the picture, as this page does, so an image that is sensitive should not be treated as hidden because it was written this way.
What this page does not do
This decodes Base64 into an image file; it does not encode, edit or inspect the picture.
| It does | It does not |
|---|---|
| Decode standard and URL-safe Base64, with or without a data: prefix and padding | Turn an image into Base64 (the other direction) |
| Name the format from the bytes and report a wrong label | Trust the label in the data URL over the bytes |
| Say why a string failed, with the position of a bad character | Repair a string that has lost characters |
| Save the original, or convert to PNG, JPEG or WebP | Resize, crop or edit (use the image resizer) |
| Show data URL, <img> and CSS snippets | Upload or keep your string |
Animated GIF and WebP files are saved exactly as they are in the original format, so they keep moving; converting them to PNG or JPEG keeps only the first frame, because that is what a still format holds. A string larger than 30 million characters is refused with a message, since a browser tab cannot decode much more.
This page or a typical converter
What this page adds to a typical Base64 to image converter.
| This page | A typical Base64 to image page | |
|---|---|---|
| Cost | Free, no sign-up | Free |
| Your string is uploaded | Never | Varies: check the page’s own statement |
| Format found from the bytes | Yes, and a wrong label is reported | Often |
| Why a bad string failed | Character and position, length, truncation | Often only “invalid” |
| URL-safe, missing = and line breaks | Accepted and reported | Varies |
| Not-an-image bytes named | PDF, ZIP, text and more | Varies |
| Data URL, <img> and CSS snippets | Yes | Some |
More converters
Every converter on the site runs in your browser, needs no sign-up, and sends nothing anywhere.
Images2
Change an image's format or size without uploading it anywhere.
JPG to PDF converter
Turn JPG pictures into one PDF in the browser, A4 or Letter pages in your order, JPGs embedded unchanged, nothing uploaded.
Open jpg to pdf converter →PNG to PDF converter
Turn PNG pictures into one PDF in the browser, pixels kept exactly, transparency kept or filled white, nothing uploaded.
Open png to pdf converter →
All 35 converters, by category: Length (10) · Weight & mass (5) · Temperature (3) · Cooking (1) · Currency (1) · Numbers & code (8) · Text (2) · Images (3) · Dates & time (2)
Frequently asked questions
How do I convert a Base64 string to an image?
Paste the Base64 string into the box, with or without the data:image prefix, and the picture appears. The tool decodes it in your browser, finds the format from the bytes and shows the pixel size. Then choose Download to save it, or pick PNG, JPEG or WebP if you want a different format from the original.
Which image formats are supported?
PNG, JPEG, GIF, WebP, BMP, ICO, SVG and AVIF are recognised and drawn by most browsers. HEIC and TIFF are recognised from their bytes too, but most browsers cannot draw them, so you can save the original file but not preview it. The format comes from the decoded bytes, not from the label in the data URL.
Do I need the data:image/png;base64, prefix?
No. A bare Base64 string works, because the format is read from the decoded bytes, and a full data URL, an img tag or a CSS rule containing one works too. If a data URL names a different type from the one the bytes show, the page uses the bytes and tells you the label was wrong.
Why is my Base64 image not showing?
Usually the string is damaged: a character outside the Base64 alphabet, an = in the middle, a length that cannot exist, or an end that was cut off. Paste it here and the page names the cause and the position of the first bad character. If it is valid but decodes to a PDF or text, it says that instead.
How do I know what image format a Base64 string is?
Read its first characters: iVBORw0KGgo is a PNG, /9j/ a JPEG, R0lGOD a GIF, UklGR a WebP and PHN2Zy an SVG. That works because the file's first bytes are fixed. This page does the check for you from the decoded bytes and lists what it found, including the first eight bytes in hex.
Can I convert Base64 to JPG or PNG?
Yes. Paste the string, pick PNG or JPEG under Save as, and download. The page redraws the decoded image through a canvas and writes the new format. Transparent areas are filled with white in a JPEG, and an animated image keeps only its first frame in a still format. An SVG has no fixed pixel size, so it stays SVG.
Are my files or data uploaded?
No. The string is decoded by your browser and the image is drawn from the bytes in memory, so nothing is sent to a server and nothing is kept: reload and the box is empty. Only your file name and choices are remembered. You can switch your connection off after the page loads and it still works.
Is Base64 the same as encryption?
No. Base64 is an encoding that rewrites bytes as 64 safe text characters so they can travel through systems built for text. It makes the data about a third longer and hides nothing, because anyone can reverse it, as this page does. Do not treat an image as protected because it is written in Base64.
Related guides
Longer answers to the questions behind the numbers.