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.
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
- Choose a JPG: Click the box above or drag the file onto it. You can also paste an image from your clipboard.
- Wait a moment: The file is encoded right away – usually in well under a second.
- 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.
- 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?
Why is the Base64 string bigger than my file?
What is the difference between Base64 and a data URI?
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.