Image Toolkit

Base64 to Image Converter

Decode Base64 and Data URIs to Image Files

Paste Base64 text or a data URI and see the image straight away, then download it as a PNG, JPG, GIF, WebP, SVG or whatever it really is. Decoding happens in your browser, so nothing you paste is uploaded.

CSS url(…) and HTML src="…" work too. Line breaks and spaces are ignored.

Guide by Ashley Whitehair, web designer at Norwich Website Design

How to convert Base64 to an image

  1. Paste the Base64

    Base64 to image is already selected above. Paste the text into the box: raw Base64, a data URI, or a whole CSS or HTML snippet that contains one.

  2. Check the preview

    The image appears as soon as the text decodes, with its real format, file size and dimensions. If something’s wrong with the text, you’re told what.

  3. Download the image

    Press Download image. The file is saved as image.png, image.jpg or whatever it really is, byte for byte as it was encoded.

What you can paste

You don’t need to tidy the text up first. The decoder finds the image data in any of these:

You pasteLooks like
Raw Base64iVBORw0KGgoAAAANSUhEUgAA…
A data URIdata:image/png;base64,iVBORw0KGgo…
CSSbackground-image: url('data:image/png;base64,…');
HTML<img src="data:image/jpeg;base64,/9j/4AAQ…" alt="">
A URL-encoded SVG data URIdata:image/svg+xml,%3Csvg xmlns=…
A value copied from JSONBase64 with \/ instead of /, or \n line breaks

Line breaks and spaces are ignored, so Base64 wrapped at 76 characters by email or command-line tools works. So does missing = padding at the end, and URL-safe Base64, which uses - and _ in place of + and /.

Telling the format from the first few characters

Every image format starts with a few fixed bytes, so its Base64 starts with fixed characters too. The decoder goes by these bytes rather than the data URI’s header, which can be wrong. You can often spot the format by eye:

Starts withFormat
iVBORw0KGgoPNG
/9j/JPEG
R0lGODGIF
UklGRWebP (a RIFF file)
PHN2Zy or PD94bWwSVG (<svg or <?xml)
QkBMP
AAABAAICO (a favicon)
JVBERi0A PDF, not an image

AVIF files start with a short box of variable length, so they don’t have one fixed prefix, but they’re recognised all the same.

Where Base64 images come from

  • API responses. Many APIs, including image-generation and screenshot services, return images as Base64 strings inside JSON.
  • HTML emails and saved web pages, where small images are embedded in the page as data URIs.
  • Stylesheets, where icons are inlined with url(data:…).
  • Databases and exports, where an image was stored as text in a field.
  • Browser code: canvas.toDataURL() and FileReader both produce data URIs.

Decoding gives you a normal image file again, ready to open, edit or upload. To go the other way, switch to Image to Base64, or see the image to Base64 guide.

When it won’t decode

  • “That isn’t valid Base64”: the text contains characters Base64 doesn’t use, such as quotes or brackets from around a larger snippet that has no data URI in it. Paste just the Base64.
  • “It decodes, but not to an image”: the text is valid, but holds a different kind of file. Base64 starting JVBERi0 is a PDF, for example.
  • The preview is broken or blank: the text was probably cut short, which is common when copying from a log or a truncated API response. The start is intact, so the format is recognised, but the image data is incomplete. Copy the whole value again.

What you paste stays on your device

Decoding happens in your browser: the text you paste and the image in it are never sent to a server. That matters when the Base64 comes from a customer’s data, a private API or an unreleased design. See our privacy policy.

Frequently asked questions

How can I tell what kind of image my Base64 is?

Look at the first characters: iVBORw0KGgo is a PNG, /9j/ a JPEG, R0lGOD a GIF, UklGR a WebP and PHN2Zy an SVG. Or paste it here: the preview names the format, worked out from the data itself.

Why does it say it decodes, but not to an image?

The Base64 is valid but contains another kind of file, most often a PDF (starting JVBERi0) or plain text. Open it with a tool for that type instead.

Why is the decoded image broken or only partly shown?

The Base64 is incomplete, usually because it was cut short when it was copied. Copy the entire value, including the end, and paste it again.

Can I decode the Base64 from a JSON API response?

Yes. Paste the string’s value, with or without its quotes around it. Escaped slashes (\/) and \n line breaks from the JSON are handled.

What is URL-safe Base64?

A variant that uses - and _ instead of + and /, so it can go in web addresses and file names. It’s decoded the same way here.

Is there a size limit?

No fixed limit. Images of several megabytes decode fine; the practical limit is your device’s memory.

How do I decode Base64 to an image in code?

In a browser, fetch(dataUri) then .blob() gives you the file. In Node.js, Buffer.from(base64, 'base64') gives you its bytes to write to disk. On Linux and recent versions of macOS, base64 -d < image.txt > image.png does it in a terminal.

Is the Base64 I paste uploaded anywhere?

No. It’s decoded in your browser, on your device, and nothing you paste is sent to a server.