Image ↔ Base64
Convert an image to a data URL, or restore Base64 into an image.
What is Image ↔ Base64
Image ↔ Base64 converts an image file into a Base64 data URL (data:image/...;base64,...), or restores pasted Base64 back into a previewable, downloadable image. Handy for inlining small icons in HTML or CSS. Everything runs in your browser; the file is never uploaded (4 MB limit).
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
Turning an image into a data URI
The file is read with FileReader as a data URL, giving data:image/png;base64,… That string can be placed directly into an img src or a CSS background with no network request, which is the entire appeal: one fewer round trip and no broken-image flash on load.
The cost is size. Base64 inflates by about a third, and the image cannot be cached separately, cannot be loaded in parallel, and blocks the render of whatever contains it. Under roughly 2 KB inlining usually wins; above that the extra bytes and the lost caching almost always lose, and well above that it visibly hurts first paint.
Where the string breaks
Data URIs in CSS need quoting discipline: a base64 body contains no quotes, but the surrounding url() still needs the right syntax, and a stray line break inserted by a formatter breaks the value. In HTML attributes, very long values are legal but unreadable, and some templating engines truncate them.
Email clients are the other trap. Many strip data URIs entirely, so an inlined icon that works on the web disappears in the newsletter. For HTML email, host the image and reference it by URL.
When to use a file instead
Keep the image as a file if it appears on more than one page, if it is larger than a few kilobytes, or if it needs cache headers, responsive variants or a CDN. The data URI approach is for one-off, tiny, render-critical assets — a favicon fallback, a spinner, a single decorative mark.
Also check the MIME type in the prefix against the actual bytes. A PNG that announces itself as image/jpeg will still render in most browsers (they sniff), but image processing pipelines downstream will fail on it, and the failure is far from the line that caused it.
How to use
- 1.Pick a direction (Encode / Decode)
- 2.Encode: choose a file. Decode: paste Base64
- 3.Run, then copy or download the result
How this compares
There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.
| Aspect | This tool | Upload-based converters | Desktop software |
|---|---|---|---|
| Where the file is processed | In your browser, on this page | On the vendor's servers, after an upload | On your own machine, after installing an app |
| Account required | No | Usually — free tiers ask you to sign in before lifting a limit | No, though a licence may be needed |
| Size you can process for free | No size cap, no run limit | A few files per hour, or a ~5–10 MB cap before a paywall | Whatever your disk and RAM allow |
| Price | Free. Pro is $9/month, and only buys larger files and AI features | Usually a subscription — roughly $7–15/month as of November 2026 | A one-off licence, or a subscription |
| Works offline | Yes, once the page has loaded | No | Yes |
| Time before work starts on a 20 MB file | Immediate — there is nothing to upload | Dominated by the upload — about 16 s on a 10 Mbps uplink | Just the app launch |
| What it cannot preserve | Output is deterministic — verify it against any other implementation | The same — the conversion is the same maths | The same, though some desktop apps re-render styles more faithfully |
Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.
Frequently asked questions
Where can I use the data URL?
Paste it into an <img src> or CSS url(). Inlining small icons saves HTTP requests, but for large images the size grows by roughly 33%, so keep inlining to small assets.
Which formats are supported?
PNG, JPEG, GIF, WebP, SVG, BMP and ICO. When decoding, the format is detected from the first bytes of the Base64 payload.
What this kind of conversion cannot keep
Encoding and hashing run through the browser's Web Crypto API or a pure-JavaScript implementation. The output is deterministic: the same input always produces the same digest, so you can verify a result against any other tool.
More in Encoding
On this page
- What is Image ↔ Base64
- What it does with your file
- How it actually behaves
- How to use it
- How this compares
- FAQ
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →