Home › Developer Tools › Base64 Encoder / Decoder

Base64 Encoder / Decoder

Base64 turns arbitrary bytes into plain ASCII letters, digits, + and / so data can travel safely through email, URLs, JSON and data URIs. Paste text to encode it, or paste Base64 to decode it back. It is an encoding, not encryption — anyone can decode it, so never use it to hide a secret.

Encoding is not encryption: Base64 output can be decoded by anyone, instantly. It protects data in transit (for example inside JSON or an email header); it does not protect data from readers. Everything runs in your browser — nothing you paste is sent anywhere.

How it works

Base64 works in groups of three input bytes (24 bits), split into four 6-bit groups, each mapped to one of 64 characters (A-Z, a-z, 0-9, + and /). When the input is not a multiple of three bytes, = padding fills the last group: one byte left over gives two characters plus ==, two bytes give three characters plus =. That is why output is always a multiple of four characters and about 33% larger than the input. URL-safe Base64 swaps + for − and / for _ and drops the padding, so the result can sit inside a URL without escaping. Worked example: "Hello, World!" is 13 bytes; grouped in threes it encodes to SGVsbG8sIFdvcmxkIQ== (20 characters, the final == because 13 = 4×3 + 1). Decoding that string returns "Hello, World!" exactly. Non-English text works the same way because the encoder first turns the text into UTF-8 bytes — for example, the single character é is two UTF-8 bytes and encodes to w6k=. Encoding is not encryption: anyone can decode Base64, so never use it to protect passwords or secrets.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding with a public alphabet — decoding takes one line of code. It exists to move binary data through text-only channels, not to hide it. For real secrecy, encrypt first and encode the ciphertext if you must.

Why does Base64 output end with = signs?

Padding marks a short final group: the input length was not a multiple of three bytes. One leftover byte produces two characters plus ==; two leftover bytes produce three characters plus =. URL-safe Base64 simply drops the padding.

Why is the output about 33% bigger?

Every three input bytes become four output characters, so the ratio is 4/3. The padding adds at most two characters. A 3 MB file becomes about a 4 MB Base64 string.

What is URL-safe Base64?

Standard Base64 uses + and /, which have special meanings in URLs, so URL-safe mode replaces them with - and _ and drops the = padding. The two alphabets are otherwise identical, and this tool decodes either one.

Why do some characters encode to more than one byte?

Text is first turned into UTF-8 bytes: plain English letters are one byte each, accented letters are two, and most emoji are four. That is why the same number of characters can produce different Base64 lengths in different languages.

Related calculators

Password Generator File Size Converter Word Counter