How to Use Base64 Encoder / Decoder
Follow these three steps to process, validate, and export your data locally inside your browser with zero server latency:
Select Encode (Plain Text → Base64) or Decode (Base64 → Plain Text).
Optionally toggle URL-safe mode (`-` and `_` instead of `+` and `/`).
Enter your text and copy or download the converted result.
How RFC 4648 Base64 Serialization Works & Solving the Browser Unicode Bug
Base64 (standardized in IETF RFC 4648) is a binary-to-text encoding scheme that translates arbitrary binary octets into a safe 64-character ASCII alphabet. It operates by grouping every three 8-bit bytes (24 bits total) into four 6-bit chunks, mapping each 6-bit value (0–63) to an ASCII character (A–Z, a–z, 0–9, +, /). When the input byte length is not divisible by 3, one or two = padding characters are appended.
In web browsers, the built-in window.btoa() and window.atob() functions were designed in the 1990s for Latin-1 (ISO-8859-1) strings and throw an InvalidCharacterError whenever any character exceeds code point 0xFF (such as emojis or CJK scripts). Our Base64 engine converts strings into a UTF-8 byte stream via TextEncoder before encoding, and reconstructs UTF-8 characters via TextDecoder upon decoding.
Base64 Is Encoding, Not Encryption
Never use Base64 alone to hide passwords, API keys, or PII. Anyone can decode a Base64 string instantaneously without a key. Even HTTP Basic Authentication (Authorization: Basic <base64>) is only safe when transmitted over an encrypted TLS/HTTPS connection.
Standard Base64 vs Base64URL (RFC 4648) Comparison
Understand when to use standard Base64 versus URL-safe Base64URL across modern web protocols:
| Attribute | Standard Base64 (RFC 4648 §4) | Base64URL (RFC 4648 §5) |
|---|---|---|
| 62nd Character (Index 62) | + (Plus sign) | - (Hyphen / Minus) |
| 63rd Character (Index 63) | / (Forward slash) | _ (Underscore) |
| Padding Character (=) | Mandatory (= or ==) | Omitted in URLs & JWTs |
| Safe in URLs & Filenames? | No (+, /, and = require % escaping) | Yes (100% unreserved URI characters) |
| Primary Use Cases | Data URIs, MIME email, PEM certs | JSON Web Tokens (JWT), OAuth 2.0, URL IDs |
Base64 Engineering Use Cases & Performance Guidelines
Apply Base64 effectively in API authentication, JWT debugging, and asset delivery:
1. Inspecting JSON Web Tokens (JWT)
Auth DebuggingA JWT consists of Header.Payload.Signature encoded in Base64URL. Enable the "URL-Safe Base64URL" checkbox to decode JWT segments cleanly without padding errors.
2. Constructing HTTP Basic Auth Headers
REST APIsHTTP Basic Auth encodes "username:password" in Standard Base64. Ensure there is no trailing newline at the end of your credentials before encoding.
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=3. Mind the 33% Bandwidth Overhead
Web PerformanceBase64 increases payload byte size by roughly 33%. Avoid Base64-encoding multi-megabyte files inside JSON bodies; use multipart/form-data or binary streams instead.
4. Handling Whitespace in PEM & MIME Blocks
Parser ResilienceMIME Base64 wraps lines every 76 characters. Our decoder automatically strips whitespace and line breaks before reconstructing your UTF-8 payload.
Practical Examples & Input/Output Reference
Encoding UTF-8 text with emojis and accents
Safely encoding multi-byte UTF-8 characters into Base64.
Sample Input
Hello, Café 🚀Expected Output
SGVsbG8sIENhZsOpIPCfmoA=Frequently Asked Questions
Why does standard browser `btoa()` fail on emojis or non-Latin characters?
Built-in `btoa()` only accepts Latin1 single-byte characters. Our tool converts strings to UTF-8 bytes via `TextEncoder` first so all Unicode text encodes accurately.