Base64 to image converter

Paste a Base64 string or a full data:image/...;base64, URI to see the picture and save it as a file. Switch the mode to turn your own image into Base64 for HTML, CSS or JSON, or use image to binary to see a picture as 0s and 1s.

Checked byTomeshia Brock
Reviewed byKhushboo Gupta
Last updated · How we test

Runs in your browser. Nothing you type is uploaded.

How to convert Base64 to an image

  1. Paste the Base64 text or the data URI into the box. Press Try a sample if you want to see how it works first.
  2. The image appears below with its type, size in bytes and width and height in pixels.
  3. Press Download to save the file with the right extension, or Open in new tab to view it at full size.

The tool reads the first bytes of the decoded data to find the format, so it still works when the data URI prefix is missing or names the wrong type. Small images are scaled up with sharp pixels so you can see them.

How to convert an image to Base64

Pick Image to Base64 in the Mode menu, then drop an image on the box or press Open file. Choose the output you need:

OutputExample startUse it in
Plain Base64iVBORw0KGgo...APIs and databases that store the bytes
Data URIdata:image/png;base64,iVBOR...Anywhere a URL is expected
HTML img tag<img src="data:image/png;base64,...Email templates and single-file pages
CSS backgroundbackground-image: url("data:image/png;base64,...")Small icons in a stylesheet
JSON{"filename": ..., "mime": ..., "data": ...}Sending a file through a JSON API

The message under the box shows how much the file grew. Base64 adds about a third, so it suits icons and small images. For large photos a normal image file loads faster and can be cached.

Parts of a Base64 image data URI: data: says the data is inline, image/png is the file type, ;base64, says the rest is Base64, and iVBORw0K is the start of the encoded PNG bytes.

How to tell the image type from Base64

Every image format starts with a fixed byte pattern, such as the 8-byte signature in the W3C PNG specification, and those bytes always encode to the same first characters:

Starts withFormatFirst bytes (hex)
iVBORw0KGgoPNG89 50 4E 47 0D 0A 1A 0A
/9j/JPEGFF D8 FF
R0lGODGIF47 49 46 38
UklGRWebP (RIFF)52 49 46 46
PHN2ZySVG3C 73 76 67 (<svg)
QkBMP42 4D

A string that starts with JVBERi0 is a PDF, not an image. Use the Base64 to PDF tool for that one. For any other start, Base64 to hex shows the first bytes so you can match them against the table above.

When the image does not show

  • The string was cut off. Long data URIs are often trimmed when copied from logs or browser tools. Copy it again from the source.
  • There is extra text around it, such as quotes or a JSON key. Paste only the part after base64, or the whole data URI.
  • The data is not an image. The tool then names the type it found, or lets you download the raw bytes to check. If it turns out to be text, the Base64 decoder shows it as readable characters.
  • The format is one your browser cannot draw, such as TIFF. You can still download the file and open it in an image program.
How Base64 images start: iVBORw0KGgo is PNG, /9j/ is JPEG, R0lGOD is GIF, UklGR is WebP, PHN2Zy is SVG and JVBERi0 is a PDF, not an image.

Frequently asked questions

What is a Base64 image?

It is an image file written as text with the 64 Base64 characters, so it can sit inside HTML, CSS or JSON without a separate file.

What does data:image/jpeg;base64 mean?

It is the start of a data URI, the format defined in RFC 2397 for data URLs. It tells the browser that the text after the comma is a JPEG image encoded in Base64.

Is there a size limit?

Files over 10 MB are refused when encoding, to keep the page responsive. Decoding is limited only by your browser memory.

Are my images uploaded?

No. Decoding and encoding happen in your browser. Nothing is sent to a server.

Scroll to Top