Base64 encoder & decoder
Text and files to Base64 and back, URL-safe variant included.
36% larger
Encode a file
The file is read locally — it is never uploaded.
How it works
Base64 represents arbitrary binary data using 64 printable ASCII characters, so it can travel through channels that only handle text — email bodies, JSON payloads, URLs, HTML attributes.
How it works
Three bytes (24 bits) are regrouped into four 6-bit values, each mapped to one character of A–Z a–z 0–9 + /. When the input is not a multiple of three, = pads the
output. That 3-to-4 ratio is why Base64 is always about 33% larger than the original.
It is encoding, not encryption
Anyone can decode it instantly — this page just did. Base64 in an HTTP Basic auth header or a JWT payload provides no confidentiality at all. If it needs to be secret, it needs to be encrypted.
The URL-safe variant
+ and / have meaning in URLs and filenames, so RFC 4648 defines a
variant using - and _ instead, usually with the padding stripped. JWTs
use it. Decoding here accepts either, restoring the padding automatically.
Unicode
The browser's btoa throws on any character above U+00FF, which is why naive
implementations break on emoji and accented text. This encodes to UTF-8 bytes first, so
anything you can type works.