Image ⇄ Base64

Upload or drag an image to get its DataURL / Base64, or turn Base64 back into a previewable, downloadable image — with size comparison and img-tag / CSS snippets. 100% client-side.

Direction
Image → Base64
Choose an image or drag & drop it here PNG · JPG · GIF · WebP · SVG · BMP · up to 20 MB — the file never leaves your browser
Select an image to encode.

What a data URI is

An inline image is written as data:image/png;base64,iVBORw0KGgo... — a media type, then the encoding, then the file bytes written in Base64. Embedded this way, the image travels with the CSS or HTML and needs no separate request.

The cost is that the file grows by roughly 33%, because Base64 stores three bytes as four characters. A 20 KB PNG becomes about 27 KB of text.

When inlining pays off

ScenarioVerdict
A repeated 1 KB icon used in many placesGood — removes a request and benefits from CSS caching
A 6 KB logo above the foldAcceptable — saves a round trip on the critical path
A 200 KB hero photoBad — bloats the stylesheet and delays first paint
An image that changes oftenBad — the whole stylesheet must be re-downloaded

The hidden costs

A practical rule

Inline anything under roughly 2 – 3 KB that appears on most pages, and keep everything larger as a separate file. Most build tools automate this threshold automatically, so the decision is usually just whether to enable the feature — and at what byte limit.

Related tools

Base64 encoder QR code generator Hash generator

FAQ

Why embed an image as Base64?
Once encoded, an image can be inlined directly into HTML, CSS or JSON with no extra request for the image file — great for small icons, email templates and single-file deliverables. The trade-off: the encoded size is about a third larger than the original.
Why is Base64 bigger than the original image?
Base64 represents 3 bytes as 4 printable characters, so the encoded size is roughly 1.33× the raw binary. Adding the DataURL prefix makes it slightly larger still — don't use it for large images.
Which formats does Base64-to-image support?
Common image types: PNG, JPEG, GIF, WebP, BMP, SVG and more. Paste a recognizable image Base64 or a full DataURL and the tool auto-detects the format.
Are images uploaded to a server?
No. Reading, encoding and restoring all happen locally in your browser; image files are never uploaded.