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. Stays in your browser.

OUTPUT FORMAT

Runs entirely in your browser

How it works

The tool reads your image 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 yourselfin 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. Use the size badge to compare 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. The encoder reads the raw file bytes, so any format your browser recognises can be converted.

Related tools

Base64
Encode text or files to Base64, decode Base64, or convert images to data URIs.
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.