Base64 to JPG Converter

Paste Base64 that holds a photo or any other image and save it as a .jpg file. Choose Original to keep a JPEG byte for byte, or JPG to re-encode with the quality you set.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Paste the Base64 text or the data:image/jpeg;base64 URI into the input box.
  2. Confirm the preview, the detected format and the image dimensions.
  3. JPG is already selected. Move the quality slider: higher values keep more detail, lower values make a smaller file.
  4. Download the .jpg file. To keep an existing JPEG exactly as it is, pick Original instead.

How a Base64 JPEG looks

Every JPEG file begins with the bytes FF D8 FF, so its Base64 always starts with /9j/. The next characters hint at the file's origin: /9j/4AAQSkZJRg is a plain JFIF image, while /9j/4Q usually means an Exif header written by a camera or phone. You will find Base64 JPEGs in mobile app uploads, form submissions, CMS exports, email attachments and photo fields in REST APIs.

JPG and JPEG are the same format; the shorter extension dates back to MS-DOS, where file extensions were limited to three characters. The correct MIME type is image/jpeg. The tool reads the bytes themselves, so a data URI labeled image/jpg or image/png is still decoded correctly.

Quality, transparency and metadata

JPEG is lossy, and each new encode throws away a little more detail. When the input is already a JPEG and you only need the file, choose Original so it is saved without a second round of compression. Use the JPG option when you want to convert a PNG, WebP or other format, or to shrink a large photo. A quality of around 80 to 90 percent is a common balance between size and sharpness.

  • Transparency. JPEG has no alpha channel, so transparent areas are filled with white. Keep transparency with PNG or WebP.
  • Metadata. Conversion redraws only the pixels, so Exif data such as the camera model or GPS location is not carried over. Original keeps the file, metadata included.

Decode a Base64 JPEG in Node.js

const fs = require('fs');
// strip a data URI prefix if present
const b64 = input.replace(/^data:[^,]+,/, '');
fs.writeFileSync('photo.jpg', Buffer.from(b64, 'base64'));

To go the other way, JPG to Base64 turns a photo into a string or data URI.

Frequently asked questions

Is JPG the same as JPEG?
Yes. Both extensions describe the same format and MIME type, image/jpeg. Rename the file freely if a program expects one or the other.
Why did the transparent background turn white?

JPEG cannot store transparency, so the converter fills transparent pixels with white before encoding. Choose PNG or WebP to keep the transparent background.

How do I avoid losing quality?

If the Base64 data is already a JPEG, download it as Original to get the exact bytes. Re-encoding as JPG, even at high quality, always adds some loss.

Does the photo keep its Exif data?

Only with Original. A converted JPG contains just the pixels, which is also a simple way to drop location data before sharing a photo.