PDFVela — pdfvela.com

How do you save Base64 code as an image file?

You have a long piece of text starting with data:image/… and you need the picture inside it — from finding the code to saving the file.

By · Updated November 10, 2026

What is a Base64 image, and why is it text?

Base64 is a way of writing a file using only letters, digits and a few symbols. That lets a picture fit into places that can only carry text: a JSON response, an HTML page, the raw source of an email or a text column in a database. The text carries the image byte for byte; decode it and you get the original file back, complete.

The code usually comes in one of two forms:

  • Data URI: it starts with a short label such as data:image/png;base64, followed by the code. The label tells you the file type.
  • Bare code: no label, it starts straight away with something like iVBORw0KGgo…. APIs usually give the type in a separate field.

1. Find the code and copy all of it

The easiest way depends on where the code lives:

  • JSON or an API response: find the field holding the picture (often named image, photo, data, content or b64_json). Copy all the text between the quotes; taking the quotes too is fine.
  • HTML or CSS: in the page source, find the src="data:image/… or url("data:image/… part. Copying the whole img tag or CSS rule also works — the tool picks the code out by itself.
  • Raw email source: in the "show original" view, attachments sit below a Content-Transfer-Encoding: base64 line as a block split into lines. Copy the whole block up to the blank line; the line breaks don't matter.
  • Browser developer tools: open the response in the Network tab, right-click the field's value and use "copy value". That copies all of it even when the long text is shortened on screen.

The most common mistake is copying only part of the code. Long text gets shortened on screen, or the selection doesn't reach the end. Where you can, use an option like "copy value", or save the code to a .txt file first.

2. Turn the code into an image

Open the Base64 to image tool and:

  1. Press "Or type / paste text", or just press Ctrl + V on the page. If the code is in a .txt file, choose the file.
  2. The picture is previewed straight away, with its type (PNG, JPG, SVG …), pixel size and file size underneath.
  3. Press Download image. The file is saved with the right extension for what is really inside.

If the code claims the wrong type (say the label is image/jpeg but it holds a PNG), the tool tells you and saves the file with the correct extension. All the decoding happens in your browser; nothing is uploaded.

3. Change the format if you need to

The decoded picture is saved in whatever format the code holds. If you need another one:

You haveYou wantTool to use
WebPJPGWebP to JPG
SVGPNGSVG to PNG
PNGJPGPNG to JPG
Any imagePDFJPG to PDF

Common mistakes

The end of the code is missing. If the picture is half-drawn, grey or won't open at all, the code was most likely cut off. With JPG this shows up as a blank lower part. Copy the code again, in full.

Other text got mixed into the code. When copying from JSON, parts of neighbouring fields can end up in the selection. The tool strips quotes, spaces and line breaks itself, but it can't separate words that landed in the middle of the code.

The code isn't an image. Base64 is used for every kind of file. Code starting with data:application/pdf is a PDF; code starting with data:font/ is a font. These can't be saved as pictures.

Pasting the code into a site you don't trust. Base64 is not encryption — anyone who sees the code sees the picture. Decode code that carries personal documents, IDs or signatures only with a tool that runs in your browser.

To go the other way and put a picture inside HTML or CSS, see How to embed an image in HTML or CSS with Base64.

Ready to try it? It is free and your file stays on your device.

Open Base64 to image

Questions about turning Base64 into an image

How can I tell that a piece of text is a Base64 image?

The easiest sign is that it starts with data:image/. Without that prefix, look at the first characters — iVBORw0KGgo means PNG, /9j/ means JPG, R0lGOD means GIF, and PHN2Zy or PD94bWwg means SVG. The text contains only letters, digits, + and /, and may end with one or two = signs.

Isn't pasting the code into the browser's address bar enough?

For a small data URI it often is. But many browsers block or restrict data addresses opened from the address bar for security reasons, and the trick does not work at all for bare code without the prefix or for code copied out of JSON. The Base64 to image tool accepts every form.

Why is the saved image blurry or tiny?

Embedded images are often kept small on purpose — an icon, a thumbnail or a preview. Decoding doesn't change the picture; you get exactly what is in the code. If you need a bigger version, you have to find the original source of the image.

The code comes from a private document — is it safe?

PDFVela's tool decodes the code in your browser; neither the text nor the image is sent to any server. It is worth checking this before pasting code into an unfamiliar site. Base64 is not encryption — anyone who has the code can see the picture.

What if the code contains a PDF?

Code starting with data:application/pdf;base64, is a PDF document, not an image. The Base64 to image tool reports that "what is inside is not a picture"; save it with the Base64 to PDF tool instead.