What Base64 is for
Base64 (defined in RFC 4648) writes arbitrary bytes using only 64 safe ASCII characters, so binary data can travel through systems built for text: email attachments (MIME), data: URIs in HTML and CSS, JSON fields, HTTP Basic auth headers and JWTs.
The cost is size: every 3 bytes become 4 characters, a 33% increase, plus up to two = padding characters at the end. The explainer below shows exactly how the bits are regrouped.
Variants
URL-safe Base64 replaces + with - and / with _ and usually drops the padding, so the result can sit in a URL or filename unchanged (JWTs use it). MIME wrapping breaks the output into 76-character lines as email requires (RFC 2045).
Frequently asked questions
Why does Base64 end with = or ==?
Input is processed 3 bytes at a time. If the last group has only 1 or 2 bytes, the output is padded with == or = so its length is a multiple of 4.
Why does the same text give a different result elsewhere?
Usually because of character encoding. This tool encodes text as UTF-8 (so é is two bytes, C3 A9). Some tools use Latin-1 or UTF-16, which produce different bytes and therefore different Base64. Trailing newlines also change the result.
How much bigger does Base64 make data?
About 33%: output length is 4 × ceil(n / 3) characters for n bytes. MIME line breaks add roughly 2.6% more.
Can I encode a file?
Yes. Choose a file and it is read locally and encoded in your browser; for images, the Image to Base64 tool also builds a ready data URI and CSS snippet.