Free · No upload · Runs in your browser

JPG to Base64 Converter

Also covers .jpeg — same format, one page.

Drag in a JPG / JPEG photo and instantly get its Base64 string and data URI — ready to paste into HTML, CSS, JSON or JavaScript. One click to copy.

100% client-side. Your photo never leaves your device.

Drop a JPG here

or paste from clipboard · JPG and JPEG both work

No JPG handy? Try a sample:

JPG to Base64, explained

Encoding a JPG to Base64 turns the photo's binary data into a plain-text string you can embed directly in your code. JPEG is a compressed, lossy format built for photographs, so its Base64 strings are far shorter than an equivalent uncompressed image — handy when you want a small inline thumbnail.

How to use it

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRg..." alt="photo" />

.banner { background-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRg...); }

What a JPG Base64 result looks like

Every JPEG encodes to the same shape — a typed prefix, then the payload:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAgGBgcG...

Two quick sanity checks: the prefix is always data:image/jpeg;base64,, and the payload always starts with /9j/ — the Base64 signature of the JPEG file header. If your string starts differently, it is either not a JPEG or it got truncated during copying. If it fails to render entirely, work through the fixes on our invalid Base64 data troubleshooting guide.

JPG vs JPEG — same converter, one page

.jpg and .jpeg are the same format — the double extension is a leftover from old Windows filename limits. This page converts both identically, and the output is always typed image/jpeg. If you have a .jpeg file, drop it straight in.

Using the string in JSON

Base64 is the standard way to move an image inside a JSON payload — for example a chat message with an attachment or an API request body. The data URI is JSON-safe as-is (no escaping needed); if you send only the raw payload, make sure it carries no whitespace or line breaks. For other transports, see Image to Base64 for APIs.

Keep an eye on size

Base64 inflates data by about 33%, and an inlined photo can't be cached on its own. For a large hero image, a normal .jpg file the browser can cache will load faster. Reserve Base64 for small thumbnails, avatars, or single-file deliverables like emails and self-contained HTML reports. If you are unsure whether an online converter or a local tool fits your workflow, read the online vs. local converter comparison.

Private by design

The conversion runs locally with your browser's FileReader API — no upload, no server. Check your Network tab and you'll see the photo never goes anywhere.

Frequently asked questions

What does a JPG Base64 string start with?

A JPEG data URI starts with data:image/jpeg;base64, and the body typically begins with /9j/ — the Base64 signature of the JPEG header.

Should I inline a large JPG as Base64?

Usually not. Base64 adds about 33% to the size and inlined images can't be cached separately. For large photos keep a normal .jpg; reserve Base64 for small images or single-file deliverables.

Is the conversion private?

Yes. Everything runs in your browser with the FileReader API. The JPEG is never uploaded to any server.

How do I put a JPG Base64 string into JSON?

Include the full data URI as a normal string field — it needs no escaping in JSON. If you send only the raw payload, strip whitespace and line breaks first. For request/response patterns see the API guide.

My JPG Base64 string won't decode — what now?

Check the prefix, whitespace, URL-safe characters, truncation and MIME type — the five most common causes, each with a fix, are in the invalid Base64 troubleshooting guide.