Base64 Encode / Decode
Convert text to and from Base64, or encode a file as a data URI.
How to encode and decode
- To encode, paste plain text in the input box and click Encode. The Base64 string appears in the result box with a note of how many characters went in.
- To decode, paste a Base64 string and click Decode. Whitespace and line breaks inside the string are ignored, so Base64 copied out of an email or a wrapped terminal works as-is.
- To encode a file, click "Encode a file" and pick anything up to 8 MB. The result is a complete data URI, ready to paste into CSS or HTML.
A worked example
Encode Hello, world! and you get SGVsbG8sIHdvcmxkIQ==. The two trailing equals signs are padding, present because 13 bytes do not divide evenly into Base64's three-byte groups. Now try café: the result is Y2Fmw6k=, eight characters for a four letter word, because the accented é occupies two bytes in UTF-8 before encoding. Decoding either string returns the original exactly. For the file path, choose a small logo PNG and the output starts with data:image/png;base64, followed by the encoded bytes; paste that whole string into a CSS url() and the image loads with no separate file request.
The UTF-8 detail that most Base64 tools get wrong
The browser's built-in btoa function throws an error the moment it meets a character outside the Latin-1 range, which is why many online encoders choke on emoji, Chinese text, or even a curly quote. This tool encodes your text to UTF-8 bytes first using TextEncoder, then converts those bytes to Base64, and reverses the process on decode. The practical upshot: any text that can exist in a browser can round-trip here, and the output matches what standard tooling like base64 on the command line produces for UTF-8 input. File encoding uses the FileReader API's native data URI mode, so the MIME type in the prefix comes from the file itself. Everything runs locally; neither your text nor your files are uploaded anywhere.
Honest limitations
Base64 is an encoding, not encryption, and it is worth repeating because the confusion is common: anyone can decode it instantly, so it must never be used to hide secrets. Decoding assumes the underlying bytes are UTF-8 text; decode the Base64 of a binary file here and you get unusable mojibake, since the tool renders text, not files. There is no download-as-file option for decoded binary. The file encoder caps at 8 MB to keep the browser responsive, and remember that Base64 inflates data by roughly a third, so a 6 MB file becomes an 8 MB string that most editors will hate you for pasting. Data URIs are great for small icons and fonts, and a bad idea for photographs.
Frequently asked questions
What is Base64 used for?
Base64 turns binary data into plain text so it can travel through systems that only handle text: embedding images in CSS or HTML as data URIs, email attachments, basic API payloads, and configuration files.
Is Base64 encryption?
No. Base64 is an encoding, not encryption — anyone can decode it instantly. Never use Base64 to protect secrets.
Does this handle emoji and non-English text?
Yes. Text is encoded as UTF-8 before Base64 conversion, so emoji, accents, and non-Latin alphabets encode and decode correctly.