What is Base64 used for?
Carrying binary data through text-only channels: email attachments, JSON fields, HTTP headers, data URLs in HTML/CSS, JWTs and configuration values that cannot hold raw bytes.
Developer tool
Encode text to Base64 or decode Base64 back to text, entirely in your browser. Full UTF-8 support, optional URL-safe output, and byte counts that show the size cost of encoding.
Quick reference
Every Base64 string is built from 64 characters: the uppercase and lowercase Latin letters, the ten digits, and two extra symbols whose identity depends on the variant.
| Character set | Symbols 62 and 63 | Commonly used by |
|---|---|---|
| Standard (RFC 4648) | + and / | MIME email attachments, PEM keys, data URLs |
| URL-safe (RFC 4648 §5) | - and _ | JWTs, query parameters, filenames |
| Legacy variants | -/_ or ./_ | Older filesystem-safe implementations |
| Input bytes | Encoded characters | Size increase |
|---|---|---|
| 1 | 4 (with ==) | 4× the input for a single byte |
| 2 | 4 (with =) | 2× the input |
| 3 | 4 | 33% larger |
| 300 | 400 | 33% larger |
How it works
Many of the systems that carry data were designed before binary transports were reliable: email bodies, HTTP headers, JSON strings, XML documents, URLs and configuration files all assume text. Base64 bridges that gap by mapping every possible byte value onto a subset of printable ASCII. Once data is in that form it survives protocols that would otherwise mangle control characters, truncate at a null byte, or reject an unexpected byte entirely.
The encoding works in groups of three input bytes, which is 24 bits, and rewrites them as four 6-bit values — each of which maps to one character in the 64-character alphabet. Three bytes in, four characters out: the encoded string is exactly four thirds the size of the input. When the input length is not a multiple of three, the final group is padded with equals signs so the output length stays a multiple of four.
The most common misconception is that Base64 protects data. It does not. There is no key, no secret and no difficulty in reversing it — anyone can decode a Base64 string instantly, which is exactly why tokens containing personal data should never be trusted simply because they look scrambled. Security comes from encryption, and integrity comes from signatures and hashes; Base64 is transport formatting.
Standard Base64 uses + and /. In a URL, + can be read as a space and / is a path separator; in a filename, / is illegal on Unix-like systems. The URL-safe variant replaces them with - and _, and padding is frequently omitted because = is also awkward in query strings. JSON Web Tokens are the best-known user of this form, which is why a JWT's three parts can look like ordinary words separated by dots.
Three problems account for most real-world Base64 failures. First, truncation: a string copied from a log or an email that lost its final characters will not decode, and the error usually appears at the end rather than where the damage is. Second, whitespace: MIME encoding wraps long strings onto multiple lines, and naive decoders treat those newlines as invalid input — this tool strips whitespace before decoding. Third, variant mismatch: decoding URL-safe input with a strict standard decoder fails on the very first - or _.
Email attachments are Base64 inside MIME parts. A data URL that embeds a small image in CSS or HTML is a Base64 payload in a string. A PNG or PDF that has been pasted into a JSON field is Base64 because JSON has no byte type. Kubernetes secrets and many CI variables hold Base64-encoded values, which is convenient for transport and meaningless as protection — a point worth remembering when reviewing configuration.
FAQ
Carrying binary data through text-only channels: email attachments, JSON fields, HTTP headers, data URLs in HTML/CSS, JWTs and configuration values that cannot hold raw bytes.
No. It is a reversible encoding with no key. Anyone can decode it instantly, so never treat Base64 as protection for sensitive data.
Every three bytes become four characters, so the output is about 33 percent larger, plus one or two padding characters when the length is not a multiple of three.
The same encoding with - instead of + and _ instead of /, usually without padding. It is used in JWTs and query parameters.
Usually truncation from copying, stray line breaks from an email client, or mixing the standard and URL-safe alphabets. This tool strips whitespace and accepts both variants.
Yes. Input is converted to UTF-8 bytes before encoding and decoded back to UTF-8 afterwards, so accented letters, Cyrillic, Japanese and emoji round-trip correctly.
No. Encoding and decoding run entirely in your browser; nothing is uploaded or logged.
Note
This tool performs standard RFC 4648 Base64 encoding and decoding. It is not encryption, and it provides no confidentiality or integrity. Do not paste secrets, private keys or personal data into any online tool, including this one, unless you have confirmed it is appropriate to do so — although processing here happens locally in your browser, the surrounding environment may not be private.