Base64 Encode/Decode
Encode text to Base64 or decode Base64 back to text, with correct UTF-8 handling for emoji and non-Latin scripts.
Why use this tool?
Encode text to Base64 for data URIs, auth headers or embedding data in JSON, or decode Base64 back to readable text - with correct handling of emoji and non-Latin scripts.
How to use it
- Choose Encode or Decode.
- Type or paste your text.
- Copy the output.
What Base64 is for
Base64 represents any data using only 64 safe characters (A-Z, a-z, 0-9, + and /), so binary data or special characters can travel through systems built for plain text: email attachments, data URIs that embed small images in HTML or CSS, HTTP Basic authentication headers, and binary fields inside JSON.
It works by taking 3 bytes (24 bits) at a time and writing them as 4 characters of 6 bits each. That's why encoded data is about 33% larger than the original, and why output often ends in one or two = signs: they pad the final group when the input isn't a multiple of 3 bytes.
Text, emoji and other scripts
Base64 encodes bytes, not letters, so text is first turned into bytes using UTF-8. This tool does that correctly, which means accents, emoji and non-Latin scripts (Bengali, Arabic, Chinese and so on) survive a round trip. The browser's built-in btoa function fails on such text, which is a common source of errors in hand-written code.
When decoding, the result must also be valid UTF-8 text. If the Base64 actually contains a binary file such as an image, the decoded "text" will look like gibberish; that's expected, not an error.
Base64 is not encryption
Anyone can decode Base64 instantly; it hides nothing. Credentials in a Basic auth header, for example, are only protected by HTTPS, not by the encoding. Use the Text Encrypt/Decrypt tool if you need to keep something secret.
A variant called Base64URL replaces + with - and / with _ and often drops the = padding, so the result is safe in URLs and file names; JWTs use it. To decode Base64URL here, replace - with + and _ with / first, and add = signs until the length is a multiple of 4.
Frequently asked questions
Why does Base64 output end with = or ==?
The = signs are padding, added when the input length isn't a multiple of 3 bytes so the output length is a multiple of 4.
Is Base64 secure?
No. It's an encoding, not encryption; anyone can decode it.
Why is the encoded text longer than the original?
Every 3 bytes become 4 characters, so Base64 is about 33% larger.