What Base64 is
Base64 writes any data, text or binary, using only 64 safe characters: A to Z, a to z, 0 to 9, + and /. Those characters pass unchanged through email, JSON, URLs and other places that would damage raw bytes. Decoding turns them back into the original bytes.
The encoder first converts your text to UTF-8, so accented letters and emoji survive the round trip.
The Base64 alphabet
| Values | Characters |
|---|---|
| 0 to 25 | A to Z |
| 26 to 51 | a to z |
| 52 to 61 | 0 to 9 |
| 62 | + (URL-safe: -) |
| 63 | / (URL-safe: _) |
| Padding | = |
Padding with =
Base64 handles 3 bytes at a time. If the data does not divide evenly, the last group is padded:
Some systems leave the padding off. The decoder here adds it back, so both forms work.
URL-safe Base64
The + and / characters have special meanings in URLs and file names, so a URL-safe variant uses - and _ instead and usually drops the = padding. JSON Web Tokens use it, for example. Choose URL under Type when encoding. The decoder accepts both variants without any setting.
Where Base64 is used
Email attachments are sent as Base64 inside the message. Data URLs put small images straight into HTML or CSS (data:image/png;base64,...). HTTP Basic authentication sends user:pass as dXNlcjpwYXNz, which is why it must only be used over HTTPS: the password is merely encoded. Our article on why Base64 is not encryption has more examples.
Questions about Base64
How do I decode Base64?
Paste the Base64 string into the box above with Base64 to Text selected. The decoder ignores spaces and line breaks, accepts the URL-safe variant with - and _, and adds missing = padding.
Is Base64 encryption?
No. Base64 has no key, and anyone can decode it in one step. It only makes binary data safe to send as text. If something must stay private, encrypt it first.
Why does Base64 end with = or ==?
Base64 works on groups of 3 bytes. When the last group has only 1 or 2 bytes, = signs fill the output up to a multiple of 4 characters. One = means the last group had 2 bytes, == means it had 1.
Why is Base64 longer than the original?
Every 3 bytes become 4 characters, so Base64 is about 33% larger than the data it encodes, plus any padding.
Why does my Base64 decode to unreadable symbols?
The data is probably not text. Base64 often carries images, PDFs, compressed files or encrypted data. The decoder here shows text only and tells you when the bytes are not valid UTF-8.
Is my data sent to a server?
No. Encoding and decoding run in your browser with JavaScript, and nothing you paste leaves your device.