JPG to Base64

Convert a JPG to Base64

Encode a JPG to a Base64 string or data URI with copy-ready CSS and HTML snippets — free and right in your browser.

Drop an image to encode

Drag & drop, paste, or pick a file

PNG · JPG · WebP · GIF · SVG — encoded on your device

JPG & JPEGCopy or .txtNo sign-up PNG · JPG · WebP · GIF · SVG

Encoding JPG photos to Base64

JPG is the most common photo format, and turning one into Base64 is handy when you need a photo inline — in an HTML email, a single-file document, or an API payload — without hosting it separately. Encoding produces a data:image/jpeg;base64 URI you can paste straight into your markup or CSS.

The tool reads your JPG in the browser and shows the exact Base64 of the original file, so the photo isn't re-compressed and the decoded result is identical. You get the raw Base64, the data URI, and ready CSS and HTML snippets, each with copy and .txt download.

How to convert a JPG to Base64

  1. Open your JPG. Drag the JPG or JPEG onto the tool, choose a file, or paste it.
  2. Choose your output. Pick the raw Base64, the data:image/jpeg URI, a CSS rule, or an <img> tag.
  3. Copy or download. Tap Copy to use it right away, or download a .txt file.

Mind the size for photos

Photos are larger than icons, and Base64 adds about a third on top. For a big JPG, a normal hosted file usually loads faster and caches better — inline Base64 is best for small images or single-file use cases.

JPG to Base64: how it works

JPEG is the most common lossy photo format; turning a JPG into Base64 is useful when a photo has to travel as text — inside an email, a JSON payload, or a single-file document — rather than as a hosted file.

Data URI shape
data:image/jpeg;base64,/9j/4AAQSkZJRgABA…
Size impact
The existing JPEG compression is untouched; Base64 then adds its usual ~33% on top, so the string is about 133% of the original .jpg size. There is no second round of lossy compression, so the photo's quality is unchanged.

When inlining as Base64 makes sense

  • You need a small photo embedded inline in an HTML email or a one-file HTML export.
  • An API or message format carries the image as a string field instead of a file upload.
  • You want a thumbnail-sized photo available without a separate request.

When a normal file or URL is better

  • The photo is full-size or high-resolution — Base64 inflates it by a third and the browser must parse the whole blob on every load, so a hosted, cacheable .jpg is faster.
  • The image is shared across pages or changes often, where an external URL caches and updates more cleanly.

Practical tip

Both .jpg and .jpeg are the same JPEG format and encode identically. Every JPEG data URI starts with data:image/jpeg;base64,/9j/ — the /9j/ opening is the Base64 of JPEG's FF D8 FF start-of-image marker, a quick way to recognise a JPEG string.

More Base64 & data URI tools

Frequently asked questions

Does encoding a JPG reduce its quality?

No. Base64 is a lossless text copy of the original JPG bytes — it doesn't re-encode the photo, so quality is unchanged.

Does it work with .jpeg as well as .jpg?

Yes. Both extensions are the same JPEG format and encode identically to a data:image/jpeg URI.

Why is the Base64 bigger than my JPG?

Base64 turns every 3 bytes into 4 text characters, adding roughly 33%. That overhead is normal for any Base64 encoding.

Where is my image processed?

The encoding and decoding happen in your browser, so the result is created on your own device. How any data associated with the tool is handled is described in our privacy policy.

More image tools