Base64 Image Encoder & Decoder

Convert images to Base64 and vice versa. Supports PNG, JPEG, GIF, WebP, BMP, SVG, and ICO. Output as Data URI, HTML <img>, CSS background-image, Markdown, JSON, or XML.
All processing happens locally in your browser — your images are never uploaded to any server.
Direction: Format:
📷
Click to choose or drag & drop an image here
PNG, JPEG, GIF, WebP, BMP, SVG, ICO — Max 10 MB
⚠ Large image (>5 MB). The encoded Base64 will be very long. Consider compressing first.
Preview
Format:-
Dimensions:-
File Size:-
Base64 Size:-
Encoding: Image → Base64
Upload or drag & drop an image to encode it to Base64. Choose from 7 output formats: Data URI (embed directly in web pages), Raw Base64, HTML <img>, CSS background-image, Markdown, JSON, or XML.
Decoding: Switch direction to decode a Base64 string back to an image — paste any Base64 or Data URI and see the image preview. The image format is auto-detected from magic bytes (PNG, JPEG, GIF, WebP, BMP, ICO, SVG).
URL-safe: Replaces + with - and / with _, and strips trailing = padding.
Formats supported: PNG, JPEG, GIF, WebP, BMP, SVG, ICO.
Privacy: All processing is done locally in your browser — your images are never uploaded.
When inlining images is worth it

Inlining an image as a data URI saves one HTTP request, but the Base64 text is roughly 33% larger than the raw bytes and cannot be cached separately from the page. That trade is worth it for small icons and single-use graphics, and usually wrong for photos and repeated assets.

Rule of thumb: inline images under a few KB — for anything bigger, a separately cached image file wins on repeat visits.