inyourbrowser.com

Convert Image to Base64

Upload any image and convert it to a Base64-encoded string ready to paste into HTML, CSS, JSON, or Markdown. Switch between a full data URI, raw Base64, or a CSS background snippet. All encoding runs in your browser using FileReader.

Drop an image or click to choose

JPEG, PNG, WebP, GIF, SVG, AVIF, up to 50 MB. Runs in your browser.

OUTPUT FORMAT

METADATA

Runs entirely in your browser

How it works

By default the tool first removes the camera and editing metadata (EXIF including GPS, XMP, IPTC, comments, and C2PA) from a copy of your image, keeping the pixels and orientation; tick Keep original metadata to encode the file unchanged. It then reads the result with the FileReader API as a data URL. FileReader returns a string of the form data:image/png;base64,XXXX, where everything after the comma is the Base64-encoded file. The tool can show the full URI, strip the prefix to return raw Base64, or wrap it in a CSS background snippet, all in your browser tab.

Processing runs in your browser

All Base64 encoding happens locally in your browser tab using FileReader. Our servers are not involved at any point. You can verify this yourself in your browser's DevTools Network tab.

Frequently asked questions

Is my image uploaded to a server?
All Base64 encoding runs in your browser using the FileReader API. Our servers are not involved at any point.
Which output format should I pick?
Choose data URI for HTML img src or JSON payloads, raw Base64 when you only need the encoded bytes, and CSS background when embedding the image inline as a stylesheet asset.
Why is the Base64 output larger than the file?
Base64 represents 3 binary bytes with 4 ASCII characters, so the encoded text is roughly 33 percent larger than the source file. The File and Out badges show the exact sizes.
Is there a recommended size limit for Base64 images?
Most build tools and browsers handle Base64 strings under 2 MB comfortably. Larger images bloat HTML payloads and slow first paint, so keep large assets as separate files.
Which image formats are supported?
JPEG, PNG, WebP, GIF, SVG, and AVIF all work. For JPEG, PNG, WebP, and GIF the data URI is built by default from a copy with the camera and editing metadata removed (EXIF including GPS, XMP, IPTC, comments, and C2PA); the image data and its orientation are unchanged. Tick Keep original metadata to encode the exact original bytes. SVG, HEIC, AVIF, TIFF, and BMP files are encoded unchanged, and the tool says so.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

Convert image
Convert between JPEG, PNG, and WebP formats. Lossless or quality-controlled.
Compress image
Reduce JPEG, PNG and WebP size with a quality slider. Compression runs in your browser.
Favicon generator
Generate favicon PNGs in 16, 32, 48, 64, 192, and 512 pixel sizes from any image. Runs in your browser.
Base64
Encode text or files to Base64, decode Base64, or convert images to data URIs.