Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to text — UTF-8 safe, with a URL-safe variant, entirely in your browser. Free, no sign-up — runs locally in your browser.

What is Base64?

Base64 is a way to represent arbitrary bytes using only 64 safe, printable characters: the letters A–Z and a–z, the digits 0–9, and two symbols (+ and /), with = used as padding. It was designed for a world of text-only pipes — email systems, early web protocols, configuration formats — that would mangle or reject raw binary data. Encode a file, an image or an encrypted blob as Base64 and it becomes ordinary text that any of those systems can carry undamaged; decode it at the other end and the original bytes come back, bit for bit.

That is all Base64 is: a transport encoding. It provides no secrecy, no compression and no integrity checking — anyone can decode it (you just did, above), and the output is about a third larger than the input. Its ubiquity comes from how many places need "binary, but as text": email attachments (MIME), images embedded in HTML and CSS as data URIs, JSON Web Tokens, HTTP Basic authentication, XML documents, and API payloads of every description.

How to use this tool

  1. To encode: type or paste text into the top field and press Encode →. The Base64 appears in the lower field.
  2. To decode: paste Base64 into the lower field and press ← Decode. The recovered text appears above. Invalid input is rejected with an explanation rather than partial garbage.
  3. Tick URL-safe when the result will live in a URL, a filename or a JWT — the output then uses - and _ instead of + and /, and drops the = padding.
  4. Text is handled as UTF-8, so text in any language — and emoji — encodes and decodes correctly.

How Base64 works

The encoder reads the input three bytes at a time. Three bytes are 24 bits, and 24 divides neatly into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, which indexes the 64-character alphabet: 0–25 are A–Z, 26–51 are a–z, 52–61 are 0–9, and 62 and 63 are + and /. Four output characters therefore carry exactly three input bytes — which is also where the 33% size increase comes from.

If the input does not divide into 3, the last group is short: one leftover byte produces two characters plus ==; two leftover bytes produce three characters plus =. The padding lets a decoder know exactly how many bytes the final group represents. Decoding runs the same machinery in reverse — characters back to 6-bit groups, groups back to bytes — and any character outside the alphabet is an error worth reporting, not something to silently skip. (Some lenient decoders ignore stray characters; this one accepts harmless whitespace from line wrapping, and rejects anything else.)

Examples

TextBase64
helloaGVsbG8=
hello worldaGVsbG8gd29ybGQ=
{"a":1}eyJhIjoxfQ==
✓4pyT

Short inputs are worth studying: hello and aGVsbG8= are the same five bytes in two alphabets, and the shared aGVsbG8 prefix of the first two rows shows how encoding is purely mechanical — same bytes in, same characters out.

Common mistakes

For the full history and design rationale, read Base64 encoding explained.

Frequently asked questions

Is Base64 encryption?

No — not even slightly. Base64 is a publicly documented encoding with no key and no secret; anyone can decode any Base64 string instantly (this page will do it). It exists to transport binary data through text-only channels, not to protect it. If you need confidentiality, encrypt first (for example with AES), then Base64 the result if it needs to travel as text.

Why does Base64 make data about 33% bigger?

Base64 carries 6 bits of data in each 8-bit character, so every 3 bytes of input become 4 characters of output: a fixed 4/3 expansion, plus up to two characters of = padding. The overhead buys compatibility with channels that only accept printable ASCII text.

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and / and pads with =. Those characters have special meanings in URLs and filenames, so the URL-safe variant (RFC 4648 §5) swaps + for - and / for _, and usually drops the padding. Tick "URL-safe" above when the output goes into a URL, a JWT, or a filename.

Why does this tool handle non-English text when others fail?

Many encoders treat text as one byte per character, which breaks anything outside plain ASCII. This tool encodes your text as UTF-8 bytes first, so accented characters, CJK text and emoji round-trip correctly — and decoding reverses the same process.

Why does my decoded output look like gibberish?

Usually one of three reasons: the input was not Base64 of text at all (it may be binary data, which cannot be shown as text); the input was encoded with a non-UTF-8 character set; or the string was truncated or copied with characters missing. The decoder above validates the input and tells you when the decoded bytes are not valid UTF-8 instead of printing garbage.

What is the padding (=) for?

Base64 works on 3-byte groups. If the input length is not a multiple of 3, the final group is short, and = characters pad the output to a multiple of 4 so decoders can reconstruct the exact byte count. Not all systems emit padding (Base64URL usually omits it); this decoder accepts both forms.

Related tools

Related guides