Base64 File Encoder / Decoder

Encode any file to base64 or decode base64 back to a file — fully local.

Ad placeholder (leaderboard)

Base64 is a way of representing binary data using only the 64 printable ASCII characters A–Z, a–z, 0–9, + and /. It lets you embed a file inside text-only contexts such as JSON payloads, HTML, CSS, or email. This free tool encodes a file to base64 and decodes base64 back to a file, all in your browser.

How it works

To encode, the tool reads your file with FileReader.readAsDataURL, which yields a string of the form data:<mime>;base64,<payload>. It splits off the payload so you can copy either the bare base64 or the full data URI. Encoding groups the file’s bytes three at a time and maps each group to four base64 characters, which is why the output is roughly 33% larger than the input.

To decode, the tool takes your pasted base64 (stripping a data: prefix if present), runs atob to recover the original bytes, packs them into a Uint8Array, and offers the result as a downloadable Blob.

Tips and notes

Base64 is an encoding, not encryption — anyone can decode it, so never treat it as a way to hide secrets. It is best for small assets; embedding a multi-megabyte file inline bloats your HTML or JSON and slows parsing. When decoding, remember to set the correct file extension yourself, because raw base64 does not record the original file name or type.

Ad placeholder (rectangle)