Base64 encoder / decoder
Encode text to Base64 or decode Base64 back to text. Full UTF-8 support, no upload, no length limits beyond your browser's memory.
What this tool does
Base64 is a way of representing arbitrary binary data using only 64 printable ASCII characters (A–Z, a–z, 0–9, plus + and /, with = as padding). It's used wherever binary data needs to travel through a channel that only handles text — embedded images in HTML, JWT tokens, email attachments, and basic-auth headers.
This tool encodes any UTF-8 text to Base64 and decodes Base64 back to UTF-8 text. Both directions handle the full Unicode range correctly, which the standard browser btoa() function does not by itself.
How Base64 works (briefly)
Three bytes of input (24 bits) are split into four groups of 6 bits, and each group is mapped to one of the 64 alphabet characters. If the input isn't a multiple of three bytes, the encoder adds = padding. The result is about 33% larger than the input.
Standard vs URL-safe
Standard Base64 (RFC 4648 §4) uses + and /, which have special meaning in URLs. The URL-safe variant (§5) uses - and _ instead and usually drops the trailing padding. Turn on the "URL-safe variant" checkbox if you're encoding for a URL parameter, JWT, or anywhere a regular Base64 string would break.
When to use Base64 — and when not to
Use it for:
- Embedding small images in HTML or CSS via
data:URLs. - Encoding binary payloads in JSON (where binary isn't natively supported).
- HTTP Basic authentication headers.
- Some database fields that don't accept binary.
Don't use it for:
- Security. Base64 is encoding, not encryption — anyone can decode it instantly.
- Large files. The 33% size penalty adds up.
- Obscuring data. It's the digital equivalent of writing in pig latin.
UTF-8 and JavaScript's footgun
The built-in btoa() function in JavaScript only handles characters in the ASCII range (0–255). Pass it any character above that — accented Latin, Cyrillic, Chinese, emoji — and it throws "InvalidCharacterError". This tool works around that by converting the input to UTF-8 bytes via TextEncoder, then encoding the bytes. The reverse direction uses TextDecoder for the inverse step.
Privacy
Everything happens in your browser. Nothing is uploaded.
Frequently asked questions
Is Base64 encryption?
Why doesn't this tool work like the built-in btoa()?
btoa() fails on any character above code point 255.What's the difference between Base64 and Base64URL?
+ and /. URL-safe Base64 replaces those with - and _ and usually drops trailing = padding.