JPG to Base64 Converter

Encode JPG/JPEG photos to Base64 byte for byte – the photo is never re-saved.

Your files are processed on your device and are never uploaded.

Encode JPG and JPEG photos to Base64 without re-saving them. The photo is not recompressed, so it keeps exactly the quality it has now. The tool gives you an HTML <img> tag, a CSS background rule, a data:image/jpeg;base64, data URI and the plain string, each with its own Copy button.

JPG to Base64 Converter with ShrinkBee

Encoding happens in your browser, byte for byte. Nothing in the file changes, and decoding the string later gives you back exactly the same file.

How to Convert JPG to Base64

  1. Choose a JPG: Click the box above or drag the file onto it. You can also paste an image from your clipboard.
  2. Wait a moment: The file is encoded right away – usually in well under a second.
  3. Pick the snippet you need: Use the HTML or CSS code to embed the file, the data URI wherever a URL is expected, or the plain string for JSON and APIs.
  4. Copy or download: Click Copy, or save the text as a .txt file. Click Choose another to encode the next file.

Where Base64 JPG Is Useful

  • Uploading a photo through an API that expects Base64
  • Saving a thumbnail in a database or JSON file
  • Embedding a small photo in an HTML email
  • Placeholder images for prototypes

Data URI or Plain String?

The plain Base64 string is only the encoded data. A data URI adds a short prefix such as data:image/png;base64, that tells the browser what kind of file it is. HTML and CSS need the data URI. Most JSON APIs want the plain string – check the API documentation if you are not sure.

Some systems, mainly email (MIME), expect the string split into lines. Tick Wrap the plain Base64 at 76 characters for that. Leave it off for code and APIs, where line breaks can break the value.

Keep Embedded Files Small

Base64 stores every 3 bytes as 4 characters, so the text is about 33% larger than the file. The tool shows the exact size of your string. An embedded file also cannot be cached on its own, so it is downloaded again with every page that contains it. Base64 suits small assets best – icons, logos, short sounds and small fonts. For big files a normal link loads faster.

To make the string shorter, reduce the photo first with Reduce Image Size in KB or Resize Image in Pixels, then encode the smaller file.

Files up to 100 MB can be encoded. Above 5 MB the tool warns you, because strings that long make HTML and CSS files slow to load.

Private and Free

Your file is read and encoded on your own device. It is never uploaded, so the tool is safe for private documents and unreleased designs. Remember that Base64 is not encryption – anyone who has the string can decode it.

Need to go the other way? Paste a string into Base64 to File or Base64 to Image to get the file back.

File to Base64 Image to Base64 PNG to Base64 PDF to Base64 MP3 to Base64 Video to Base64 Font to Base64 Base64 to File

Frequently Asked Questions

How do I convert a JPG to Base64?
Choose or drag a JPG into the box above. It is encoded at once, and you can copy the plain Base64 string, the data URI or the ready-made HTML or CSS code.
Why is the Base64 string bigger than my file?
Base64 writes every 3 bytes as 4 text characters, so the result is about 33% larger. The file itself does not change, and decoding gives back the exact original.
What is the difference between Base64 and a data URI?
The Base64 string is just the encoded data. A data URI adds a prefix like data:image/png;base64, so browsers know the file type. Use the data URI in HTML and CSS and usually the plain string in JSON.
Does encoding change the quality of my image?
No. The image is not re-saved or recompressed – its bytes are encoded exactly as they are, so quality and transparency stay the same.
How do I use a Base64 image in HTML?
Copy the HTML <img> tag snippet and paste it into your page. For a background, copy the CSS background snippet into your stylesheet.
Is there a size limit?
You can encode files up to 100 MB. For embedding in web pages, keep files small – ideally under 100 KB – so pages stay fast.
Can I turn the Base64 back into a file?
Yes. Paste the string into Base64 to File and download the original file again.
Is JPG to Base64 free to use?
Yes. JPG to Base64 is completely free, with no sign-up, no watermark and no limit on how many times you use it.
Are my files uploaded to a server?
No. Your files are processed directly in your web browser on your own device. Nothing is uploaded or stored, and the file is gone from memory when you close the tab.

More Base64 Tools

Made With ♥ By ShrinkBee