Base64 Encoder / Decoder
Encode text or files to Base64, or decode it back.
What is Base64?
Base64 is a way of representing binary data — images, PDFs, or any bytes at all — using only 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). It's how email attachments, data URIs and many APIs embed binary content inside text formats like JSON, XML or HTML. Base64 is not encryption; anyone can decode it instantly.
How to encode or decode
- 1Choose Encode or Decode at the top.
- 2To encode: paste text or drop a file, optionally add a data: URI prefix.
- 3To decode: paste Base64 text or a full data URI.
- 4Copy the result, or download it when the decoded output is a binary file.
Text and file handling
Text is encoded with TextEncoder, so multi-byte UTF-8 characters — emoji, accented letters, non-Latin scripts — round-trip correctly, unlike the raw btoa() function which only handles Latin-1. When decoding, the tool first tries to interpret the bytes as UTF-8 text; if that fails, it treats the result as a binary file and offers it as a download instead.
Frequently asked questions
›Is this the same as encryption?
No. Base64 is a reversible encoding, not encryption — it has no secret key and provides no confidentiality. Anyone with the Base64 string can decode it back to the original data instantly.
›Why did decoding show 'binary data' instead of text?
The decoded bytes weren't valid UTF-8 — meaning the original data was a file (image, PDF, archive, etc.), not plain text. Use the Download button to save the decoded bytes as a file.
›What's the data URI prefix for?
A data URI (e.g. data:image/png;base64,iVBOR...) embeds the MIME type alongside the Base64 data, letting browsers render it directly — for example, pasted straight into an <img src="..."> attribute or a CSS background-image.
›Does encoding a file ever fail?
It can if the browser can't read the file (rare, usually a permissions issue) or the file is extremely large. Everything happens locally, so there's no upload size limit imposed by a server — only your device's memory.
›Is my file or text uploaded anywhere?
No. Encoding and decoding both run entirely in your browser using the FileReader and TextEncoder/TextDecoder APIs — nothing ever leaves your device.