Formula
3 bytes (24 bits) → 4 characters of 6 bits eachEncoded length = 4 × ⌈bytes ÷ 3⌉ How it works
Base64 represents arbitrary bytes using only 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes of input become 4 characters, so encoded data is about a third larger. The = signs at the end are padding that makes the length a multiple of four.
Text is first converted to UTF-8 bytes, so accented letters, Chinese characters and emoji round-trip correctly — the browser's built-in btoa() fails on these. When decoding, the tool accepts both alphabets, missing padding and stray whitespace or line breaks, which is common in emails and PEM files.
The URL-safe variant (Base64URL) swaps + and / for - and _ and drops the padding, so the result can sit in a URL or file name without escaping. JSON Web Tokens use it.
Base64 is an encoding, not encryption: anyone can decode it. Encoding and decoding happen in your browser, so secrets you paste are not sent anywhere — but do not rely on Base64 to hide them.
Frequently asked questions
Why does decoding give an error about UTF-8?
The Base64 holds binary data — an image, PDF or compressed file — rather than text. The bytes decoded correctly but cannot be shown as characters.
Why is Base64 used at all?
Many systems — email, JSON, URLs, HTML attributes — only handle text safely. Base64 lets you carry binary data such as images or keys through them without corruption.
How much bigger does Base64 make data?
About 33% larger, plus up to two padding characters. A 3 MB image becomes roughly 4 MB of Base64.