inyourbrowser.com

Image to Base64

Image to Base64 is an image tool that encodes a picture file as Base64 text. It outputs a full data URI, the raw Base64 payload or a CSS background-image snippet, strips EXIF and GPS metadata from JPEG, PNG, WebP and GIF files by default, and copies the result in one click. The tool runs in your browser.

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 to convert an image to Base64

  1. Drop an image on the upload area or click to choose a file.
  2. Pick an output format: full data URI, raw Base64, or CSS background.
  3. Click Copy to put the encoded string on your clipboard.
  4. Paste into an HTML img src, a CSS background, a JSON field, or Markdown.

Common uses

  • Inlining a small icon or logo in an HTML email so it renders without an external request
  • Embedding a placeholder image directly in a CSS file or design token using a background url()
  • Including image bytes in a JSON payload for an API client, before sharing as a single document
  • Building a standalone HTML report that bundles all assets inline, then compress images first to keep the document small
  • Encoding text or a token instead of an image? Switch to the text Base64 encoder.

Technical specification

  • Algorithm or formula: By default a JPEG, PNG, WebP, or GIF is first copied without its metadata blocks (EXIF including GPS, XMP, IPTC, comments, C2PA), keeping the compressed image data byte for byte and the EXIF orientation; Keep original metadata skips this, and other formats are encoded unchanged with a note. FileReader.readAsDataURL then produces a complete data:{mime};base64,... URI in one step. Raw-Base64 output strips the URI prefix; CSS background snippet wraps the URI in background-image: url(...).
  • Browser API or library: FileReader API and the site's own metadata filter. No external library.
  • Input limits: Files up to 50 MB. The File and Out badges show the original and encoded sizes, and a note appears when the output passes 2 MB.
  • Output: Three formats selectable: full data URI, raw Base64 payload, or CSS background snippet. Copyable to clipboard.
  • Known limitations: No automatic chunking for MIME line-length limits. Large images encoded inline can slow down page parsing in the consuming HTML or CSS file.

Frequently asked questions

How much larger is a Base64-encoded image than the original file?
About 33 percent larger, because Base64 uses 4 text characters for every 3 bytes. A 60 KB PNG becomes about 80 KB of text. The Out badge next to File shows the exact encoded size.
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.
What output formats are available?
Three formats are offered: a full data URI starting with data:image, the raw Base64 payload alone, and a ready-to-paste CSS background snippet.
Which image formats are accepted?
JPEG, PNG, WebP, GIF, SVG, and AVIF are all supported. Any image format the browser can read can be encoded.
Does the tool remove EXIF and GPS data before encoding?
Yes, by default for JPEG, PNG, WebP and GIF. The tool copies the file without its EXIF (including GPS), XMP, IPTC, comment and C2PA blocks, keeps the image data and orientation unchanged, and encodes that copy. Tick Keep original metadata to encode the exact original bytes. SVG, AVIF, HEIC, TIFF and BMP files are encoded unchanged, and the tool says so.
When should I avoid inlining images as Base64?
For images over about 2 MB it is usually faster to keep them as separate assets so the browser can cache them and parallelise downloads.

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.

Reviewed and tested September 30, 2026.