Base64 Encoder / Decoder
Encode text to Base64 or decode it back — instantly and privately in your browser.
Paste text to encode it as Base64, or paste Base64 to decode it back. Free. No sign-up. Runs in your browser, nothing is uploaded.
Choose Encode to turn text into Base64, or Decode to read Base64 as text. The result appears as you type; Copy puts it on the clipboard. Encoding has a URL-safe option that uses - and _ and drops the = padding. Decoding accepts both variants, ignores whitespace and line breaks, and strips a leading data:…;base64, prefix for you.
What Base64 does to your data, byte by byte
Base64 takes three bytes (24 bits) at a time and splits them into four 6-bit groups. Each group picks one of 64 characters: A–Z, a–z, 0–9, + and /. The classic example:
Man= bytes 77, 97, 110 → bits010011 010110 000101 101110→T W F u→TWFu
When the input isn't a multiple of three bytes, the last group is padded with =:
| Input | Bytes | Base64 |
|---|---|---|
Man | 3 | TWFu |
Hi | 2 | SGk= |
H | 1 | SA== |
Hello | 5 | SGVsbG8= |
é | 2 (UTF-8) | w6k= |
😀 | 4 (UTF-8) | 8J+YgA== |
How much bigger does Base64 make a file?
Every 3 bytes become 4 characters, so the output length is 4 × (bytes ÷ 3, rounded up):
| Original size | Base64 length |
|---|---|
| 10 bytes | 16 characters |
| 100 bytes | 136 characters |
| 1,000 bytes | 1,336 characters |
| 1 MB (1,048,576 bytes) | 1,398,104 characters (≈ 1.33 MB) |
That 33% overhead is why Base64 suits small things: an icon inlined in CSS as a data URI, a signature in a JSON field, a short token. For a 2 MB photo, a normal file upload is the better route. Email adds line breaks every 76 characters on top, so attachments grow a little more than a third.
Recognizing what a Base64 string contains
If decoding gives you "binary data" in place of text, the first few characters usually reveal the file type, because every format starts with the same signature bytes:
| Starts with | It's probably |
|---|---|
eyJ | JSON beginning with {" (also the start of every JWT) |
iVBORw0KGgo | PNG image |
/9j/ | JPEG image |
R0lGOD | GIF image |
JVBERi0 | PDF document |
UEsDB | ZIP archive, or a DOCX/XLSX, which are ZIP files inside |
A string starting with eyJ and containing two dots is a JSON Web Token; the JWT Decoder splits it into header and payload for you.
Standard vs. URL-safe Base64
+ and / mean something inside URLs, and = does too in query strings. URL-safe Base64 (also called base64url) replaces them with - and _ and usually leaves off the padding. JWTs and many API tokens use it. ?>? shows the difference: standard Pz4/, URL-safe Pz4_.
Tick URL-safe when the result has to go into a link, a filename or a cookie. When decoding you don't need to choose: both forms are recognized automatically. For percent-encoding whole URLs, use the URL Encoder.
Base64 is not a way to hide anything
HTTP Basic Authentication sends user:pass as dXNlcjpwYXNz, and that header is readable by anyone who intercepts it, which is why Basic Auth is only safe over HTTPS. The same goes for "obfuscated" API keys in config files or front-end code: Base64 is a costume, not a lock. To check whether two values are identical without revealing them, use a hash from the Hash Generator; for real secrecy, use actual encryption.
When the decoded text turns out to be a block of JSON, the JSON Formatter makes it readable. Encoding and decoding both run in your browser, so tokens and keys you paste here aren't sent anywhere.
Frequently asked questions
Related tools
All Developer tools →- JSON FormatterFormat, beautify and minify JSON with instant validation — all in your browser.
- URL Encoder / DecoderEncode or decode URLs and query components instantly and privately in your browser.
- Hash GeneratorGenerate SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text — privately in your browser.
