Free Online Base64 Encoder & Decoder
Encode any text to Base64 or decode Base64 strings back to plain text instantly. Our tool supports UTF-8 encoding, URL-safe Base64 (RFC 4648), and shows input/output sizes with compression ratios. Everything runs in your browser — your data never leaves your device.
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used to encode data that needs to be transmitted over text-based protocols like email (MIME), HTML (data URIs), JSON (API payloads), and URLs.
Base64 encoding increases the data size by approximately 33% (every 3 bytes of input becomes 4 bytes of output). This tradeoff is acceptable because it guarantees the encoded data contains only safe ASCII characters that won't be corrupted during transmission.
How Base64 Encoding Works
Base64 converts every 3 bytes of input into 4 ASCII characters. Here's how the word “Man” is encoded step by step:
| Step | M | a | n |
|---|---|---|---|
| ASCII value | 77 | 97 | 110 |
| Binary | 01001101 | 01100001 | 01101110 |
| Combined (24 bits) | 010011 010110 000101 101110 | ||
| Base64 index | 19 → T 22 → W 5 → F 46 → u | ||
| Result | TWFu | ||
When the input length is not a multiple of 3, padding characters (=) are added to the output. For example, “Ma” encodes to “TWE=” (one padding character), and “M” encodes to “TQ==” (two padding characters).
The Base64 Alphabet
The standard Base64 alphabet consists of 64 characters plus the padding character:
Standard vs URL-Safe Base64
| Feature | Standard (RFC 4648) | URL-Safe |
|---|---|---|
| Characters | A-Z, a-z, 0-9, +, / | A-Z, a-z, 0-9, -, _ |
| Padding | = (required) | No padding |
| Safe in URLs | No (+ and / need escaping) | Yes |
| Use case | Email, HTML, JSON, APIs | URLs, filenames, tokens |
Common Uses for Base64
Data URIs
Embed images, fonts, and other files directly in HTML/CSS using data:image/png;base64,...
Email attachments
MIME encoding uses Base64 to safely transmit binary files through email servers
API payloads
Encode binary data in JSON API requests and responses where only text is allowed
JWT tokens
JSON Web Tokens use Base64url encoding for the header and payload segments
Basic auth
HTTP Basic Authentication encodes username:password as Base64 in the Authorization header
Storing binary in text
Database fields, config files, and environment variables that only support text strings
Frequently Asked Questions
No. Base64 is encoding, not encryption. It transforms data into a different representation but provides zero security. Anyone can decode Base64 instantly. Never use Base64 to protect sensitive data — use proper encryption (AES, RSA) instead.
Base64 represents every 3 bytes of input as 4 ASCII characters, resulting in a ~33% size increase. This is the tradeoff for ensuring the data only contains safe, printable characters.
Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, and removes padding (=). This makes it safe to use in URLs, filenames, and query parameters without additional escaping.
Yes. Everything runs in your browser using JavaScript’s built-in btoa() and atob() functions. Your text never leaves your device — nothing is uploaded or stored.
Yes. We handle UTF-8 encoding properly, so you can encode and decode text in any language including emoji, CJK characters, and special symbols.
There’s no hard limit, but very large inputs (10MB+) may slow your browser since everything runs client-side. For typical text encoding, it’s instant.