Encoder / Decoder
Base64 Encoder / Decoder
Convert text to and from Base64 with full UTF-8 support — Chinese, emoji, and accents round-trip safely. Everything runs locally in your browser; nothing you type is uploaded or stored.
Plain text → Base64
How it works
Base64 re-encodes arbitrary bytes into 64 printable ASCII characters — A-Z, a-z, 0-9, plus + and / — padded with = to a multiple of four. Every three input bytes become four output characters, a fixed 33% size increase. The naive btoa() only accepts Latin-1 and throws on anything above U+00FF, which is why pasting Chinese or emoji into a plain encoder fails. This tool first converts your text to UTF-8 bytes with TextEncoder, maps each byte onto a character code, and only then calls btoa(). Decoding reverses the pipeline: atob() recovers the byte string and TextDecoder restores the original UTF-8 text, so non-ASCII input round-trips losslessly.
Use cases
Embed small images as data URIs in HTML or CSS, pass binary data through JSON or URL query strings, prepare credentials for HTTP Basic authentication, or move short snippets through channels that only accept printable text. Remember that Base64 is an encoding, not encryption — anyone can decode it, so never treat it as a security measure.
Troubleshooting
- “Invalid Base64 input” — remove spaces, newlines, or quotes, and restore any missing = padding.
- Mojibake after decoding — the source was probably encoded in Latin-1 or another charset, not UTF-8. Re-encode the original with a UTF-8-aware tool.
- Missing = padding — URL-safe Base64url drops the padding and swaps + / for - _.
- Empty result — a valid Base64 string can decode to zero bytes, so an empty output is not always an error.
FAQ
Is Base64 a form of encryption?
No. Base64 is reversible encoding, not encryption. Anyone can decode it, so never use it to protect secrets, passwords, or sensitive data.
Why does my emoji or Chinese text turn into garbled output in other encoders?
The plain btoa() function only accepts Latin-1 characters and throws on anything above U+00FF. This tool converts text to UTF-8 bytes first, so Chinese, emoji, and accented letters round-trip correctly.
Why is the output about one third longer than my input?
Every three input bytes become four Base64 characters, a fixed 33% size increase. Padding with = is added to reach a multiple of four.
Why do some Base64 strings end with = signs?
The = characters are padding that fill the last group up to a multiple of four characters. URL-safe Base64url variants drop the padding and swap + / for - _.
Is my text uploaded anywhere?
No. Encoding and decoding happen entirely in your browser using TextEncoder, btoa, atob, and TextDecoder. Nothing you type is sent or stored.