About the JPEG to Base64 Converter
JPEG carries photographs, so the files are usually bigger than the icons people normally inline. Encoding one still has its uses: a thumbnail in an email that must not depend on remote images, a placeholder that has to be present before the first paint, a picture posted to an API that accepts a Base64 field, or a fixture in a test suite that should not touch the file system.
Choose a file and the bytes are read locally and encoded. The JPEG signature is detected from the first bytes, so the resulting data URI declares image/jpeg even if the file arrived named with a stray extension. Every byte is copied verbatim, which means the picture is not recompressed and no quality is lost, and it also means embedded EXIF metadata such as the camera model and any GPS coordinates travels with it.
The status line gives the source size and the encoded character count, and photographs make the trade off obvious: a 400 kilobyte JPEG becomes more than half a megabyte of text that no browser can cache on its own. Resize or compress the picture before encoding if the destination has a size limit.
Decode an existing string with Base64 to Image, or encode a different format with PNG to Base64.
How to use
- Choose, drop or paste a JPG or JPEG file.
- Select the output shape, from a plain data URI to a JSON object with the file metadata.
- Check the encoded length in the status line, then copy the result.
Common questions
- Does encoding reduce the image quality?
- No. The bytes are copied exactly, so the picture is identical to the file you selected.
- Is EXIF data included?
- Yes. Everything in the file is encoded, including camera details and any location tags, so strip them first if that matters.
- Are .jpg and .jpeg treated differently?
- No. Both are the same format and both produce an image/jpeg data URI.
- Can I email a photo this way?
- For a small thumbnail, yes. Large inline photos push the message size up and some clients refuse to render them.