JPEG to Base64

Encode JPG and JPEG photos as Base64 data URIs.

Drag & drop a file here, or click to browse

Drop a JPG, JPEG, or JFIF file here. Max 10 MB, converted in your browser.

JPEG to Base64 Converter

Convert JPG, JPEG, and JFIF photos into a Base64 string or a data:image/jpeg;base64,... URI. The file is read locally, so private photos never leave your computer. You get a preview, the size before and after encoding, and six output formats to copy or download.

JPEG in a nutshell

JPEG was standardized in 1992 by the Joint Photographic Experts Group and is still the most widely used image format on the web. It uses lossy compression based on the discrete cosine transform: the picture is split into 8×8 blocks and fine detail the eye barely notices is thrown away. That makes it excellent for photographs and gradients but poor for sharp text or line art, which get visible artifacts. JPEG has no transparency and no animation, but it is supported by literally every browser, email client, and device.

JPG vs JPEG naming

The extensions .jpg, .jpeg, .jpe, and .jfif all describe the same format. The short .jpg form is a leftover from MS-DOS 8.3 file names. Whatever the extension, the correct MIME type in a data URI is image/jpeg, and the Base64 string starts with /9j/ because of the FF D8 FF marker.

Shrink before you encode

Because Base64 inflates data by a third, a 200 KB photo becomes roughly 270 KB of text. Before inlining a JPEG:

  • Resize it to the size it will actually be displayed at.
  • Re-save it at quality 70–80 with progressive encoding.
  • Strip EXIF metadata (camera model, GPS location) — it adds bytes and may leak private data.

When inlining makes sense

Inline JPEGs are handy for tiny thumbnails, blurred placeholders (LQIP), email banners that must show without "load images", and JSON payloads for image APIs. For anything bigger, host the file normally. Need transparency? Use PNG to Base64. Want a smaller modern format? Try WebP to Base64. To verify a string, open Base64 to Image.

Frequently Asked Questions

No. JPG and JPEG are the same format. The three-letter .jpg extension comes from old Windows/DOS systems that limited extensions to three characters. Both use the MIME type image/jpeg, so the data URI is always data:image/jpeg;base64,... — there is no image/jpg type.

No. The tool encodes the file bytes exactly as they are, without re-compressing. The image quality is identical to the original; only the representation changes, and the text is about 33% larger than the binary file.

JFIF (JPEG File Interchange Format) is the most common container for JPEG data. Windows sometimes saves downloaded images with the .jfif extension. It's still a normal JPEG, so you can convert it here and use it as image/jpeg.

Every JPEG begins with the Start Of Image marker FF D8 FF. In Base64 those bytes become /9j/, so a string starting with /9j/4AAQSkZJRg is a JFIF JPEG and /9j/4QAYRXhpZg or similar indicates an EXIF JPEG from a camera.