π Base64 Encoder
Convert any text into Base64. Encoding happens entirely in your browser β nothing you type is ever sent to a server. UTF-8 is handled correctly, so emoji and non-Latin scripts encode exactly as they should.
From characters to bytes to Base64
Your text is first turned into UTF-8 bytes, then every three bytes become four
characters of six bits each, padded with = to a multiple of four. That is
why the three counters above rarely agree:
"cafe" with an accented e 4 characters 5 bytes "Y2Fmw6k=" 8 Base64 chars
a waving-hand emoji 2 characters 4 bytes "8J+Riw==" 8 Base64 chars
Output length is 4 x ceil(bytes / 3), so Base64 always costs about a
third more than the raw data. Only bytes are encoded, never characters - which is
exactly why emoji and non-Latin scripts survive the round trip.
The two options
- URL-safe alphabet swaps
+for-and/for_and drops the trailing=. The emoji above becomes8J-Riw, which survives a query string, a filename or a JWT segment untouched. - Wrap at 76 characters inserts line breaks for MIME, the width email bodies have used since RFC 2045. Copy takes the wrapped text as shown; the character count ignores the newlines.
TextEncoder and btoa, so nothing you
type is sent anywhere.Frequently asked questions
How much larger does Base64 make the data?
Roughly 33% before padding. Three bytes always become four characters, so 300 bytes give 400 characters and 301 bytes give 404 - a jump to the next four-character block, two of which are padding.
When should I use URL-safe Base64?
Any time the value goes in a URL, a filename or a cookie. Standard Base64's
+ becomes a space when a query string is parsed and /
reads as a path separator. JWTs use the URL-safe form with the padding removed,
which is what this checkbox produces.
Does Base64 keep the text secret?
No. There is no key and no secret - decoding needs nothing but the string. Use it to move bytes safely through text-only channels, never to hide credentials.