Base64 File Encoder & Decoder

Encode any file to Base64 or a data URL, and decode Base64 back to a downloadable file.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A Base64 file converter that works in two directions, entirely inside your browser. In encode mode it turns any file — a PNG, JPEG, SVG, PDF, web font, JSON document or zip archive — into a Base64 string or a complete data: URL you can paste into HTML, CSS, JSON, an email template or a database field. In decode mode it takes a Base64 string (or a full data URL) and rebuilds the original bytes into a real file you can download. It is built for developers embedding small assets inline, support engineers reconstructing a file someone pasted into a ticket, and anyone who needs to move binary data through a text-only channel.

How it works

Encoding uses the browser’s FileReader API. When you drop or choose a file, the reader produces a data: URL — the MIME type plus the Base64 payload — which the tool splits so you can copy either the full data URL or just the raw Base64. A checkbox toggles the data: prefix on or off, and a live readout shows the original byte size, the detected MIME type and the exact character length of the output (always about 33% larger than the source, which is the cost of Base64).

Decoding reverses the process with the built-in atob function. Paste raw Base64 or a complete data URL: the tool strips any data:…;base64, prefix, validates that the remaining text is well-formed Base64 (length divisible by four, only the allowed alphabet and padding), converts it to a byte array, wraps it in a Blob with the right MIME type, and triggers a download. If the payload is an image it even renders an inline preview before you save. Every conversion you run is logged to a small history list in localStorage so you can see what you recently encoded or decoded — that history stays on your device and can be cleared with one click.

Example

Suppose you have a 12 KB PNG logo you want to inline in a single-file HTML email so it never breaks when the recipient’s mail client blocks remote images. Drop the PNG into the encoder, keep the data: prefix ticked, and copy the result — something like data:image/png;base64,iVBORw0KGgo…. Paste that straight into the src of an <img> tag and the image travels with the document.

Going the other way: a colleague pastes a long data:application/pdf;base64,JVBERi0… string into a chat. Switch to Base64 -> File, paste it in, type report as the name, and click decode — you get report.pdf back, byte-for-byte identical to the original, with the extension chosen automatically from the embedded MIME type.

Original fileApprox. Base64 lengthdata: URL prefix
12 KB PNG~16,000 charsdata:image/png;base64,
48 KB PDF~65,000 charsdata:application/pdf;base64,
2 KB SVG~2,700 charsdata:image/svg+xml;base64,

Everything is computed locally in your browser — no file is ever uploaded, stored or transmitted.

Ad placeholder (rectangle)