Loading Base64 to Image Converter...

How to Convert Base64 to a JPG Image

Photos travel as Base64 more often than you might expect: a profile picture in a user API, a scanned receipt in a mobile app's JSON payload, a camera snapshot logged by an IoT device, an image inlined into an HTML email. When you need to actually look at one of those photos, or keep it as a normal .jpg file, paste the string here.

Step 1

Paste the Base64 JPEG

Paste the string into the input panel. It can be a bare value that starts with /9j/, a full data:image/jpeg;base64, URI, or a value copied straight out of JSON with its quotes. Line breaks from email bodies are fine, and you can also upload a .txt file holding the string.

•
Spot a JPEG quickly: the string starts with /9j/, usually as /9j/4AAQSkZJRg (a JFIF file) or /9j/4Q (a camera file that opens with its EXIF block).
•
Prefix optional: data:image/jpeg;base64, or the misspelled data:image/jpg;base64, is stripped for you.
•
About the Sample button: it loads a tiny PNG, not a JPEG, so the result says PNG. Paste your own photo string to see a JPEG.

What a Base64 JPEG looks like

# bytes FF D8 FF E0 ... JFIF
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgH...

# the same file as a data URI in HTML
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRg...">
Step 2

Check the format and the photo

A moment after you paste, the Format line shows what the bytes really are and the photo appears in the preview. If a character does not belong in Base64, the error gives its line and column.

•
Sideways phone photos: the preview turns them upright using the EXIF orientation tag. The downloaded file keeps the tag as it was.
•
Only the top of the photo shows up? The string was probably cut short while copying. Base64 strings from logs and debuggers are often truncated, so copy the full value from the source.
•
Not a JPEG after all: a PNG, WebP or GIF is labelled as such and saved with its own extension. Text, PDFs and archives get an error; Base64 to File saves those.
Step 3

Download the JPEG

Click Download to save the decoded file. On larger screens you can type a file name first; the .jpeg extension is added for you.

•
Smaller than the string: Base64 spends four characters on every three bytes, so the .jpeg file is about three quarters the length of the text you pasted.
•
Next photo: click Clear and paste the next string.
•
Going the other way: JPG to Base64 turns a photo into a Base64 string or data URI.

JPEG inside Base64, briefly

A JPEG file is a sequence of marked segments: the start-of-image marker FF D8, an APP0 (JFIF) or APP1 (Exif) header, quantisation and Huffman tables, the compressed image data, and the end marker FF D9. Base64 writes all of those bytes with 64 text-safe characters so they can sit inside JSON, XML or a data: URI.

Decoding is a straight reversal, which is why the photo comes back unchanged. If your string came out of a larger JSON response, JSON to Table can help you find the field it sits in.

Frequently Asked Questions

How can I tell a Base64 string holds a JPEG?

Every JPEG file starts with the bytes FF D8 FF, and in Base64 that always comes out as /9j/ at the very beginning. If your string starts with iVBOR it is a PNG instead, and R0lGOD means GIF. The page also checks the decoded bytes for you and prints the format it found.

Should the prefix be data:image/jpeg or data:image/jpg?

The registered type is image/jpeg. image/jpg is a common slip, and most browsers forgive it, but some strict parsers and email clients do not. Here it makes no difference: either prefix is removed before decoding, and the format is taken from the bytes, not from the label.

Will the decoded photo lose quality?

No. Base64 is only a text spelling of the original bytes, so decoding gives back the exact file that was encoded: same pixels, same compression, same file size. Nothing is re-saved as JPEG on the way, so there is no extra generation of compression artefacts.

Does the downloaded file keep its EXIF data?

Yes, all of it: camera model, capture date, orientation, and GPS coordinates if the phone recorded them. Check for location data before you publish a photo that came out of someone else’s app. The preview turns sideways phone photos upright because the browser reads the orientation tag, but the file itself is not changed.

Why is the file saved as .jpeg and not .jpg?

They are the same format; .jpg only exists because old Windows systems allowed three-letter extensions. The download uses .jpeg, and you can rename it to .jpg without changing anything inside. If you type a file name ending in .jpg, the page replaces that ending with .jpeg.

My image has a transparent background. Will it become a JPG?

JPEG cannot store transparency, and this page does not convert between formats. A transparent image is almost always a PNG or WebP; the page will label it that way and save it with its real extension. To turn it into a JPG, open it in an image editor and export it with a background colour.

Is the photo uploaded anywhere?

No. The Base64 is decoded in your browser, and the preview and download are built there too. Nothing is sent to our server and nothing is kept, so the editor is empty again after a reload.

Related pages: JPG to Base64 · Base64 to PNG · Base64 to Image