Using the Base64 encoder
Type or paste on the left, read the encoded text on the right. Swap the boxes to decode, or go to the decoder if that's the job.
Character set decides how your text becomes bytes before encoding. Leave it on UTF-8 unless you know the text came from an older system. Variant picks the output alphabet: Standard, URL-safe for anything headed into a web address, or MIME, which wraps at 76 characters the way email expects.
What is Base64?
Base64 reads three bytes at a time and writes them as four characters from a 64-character alphabet. Three bytes is 24 bits; four characters carry six bits each. The arithmetic is exact, and the output is a third longer than the input.
When the input doesn't divide by three, the last group is padded and the output ends in one or two = signs. That padding is the easiest way to recognise Base64 on sight, and a length that isn't a multiple of four means something was cut off.
The Base64 alphabet
| Characters | Values |
|---|---|
| A–Z | 0–25 |
| a–z | 26–51 |
| 0–9 | 52–61 |
| + | 62 |
| / | 63 |
| = | padding |
The Base64 alphabetstringmash.com/base64-encode
Why it exists
Email was built for text, and for years it was built for seven-bit text. Push raw bytes through it and gateways would strip the eighth bit, rewrite line endings, or read a stray byte as a control code. Anything that wasn't plain English arrived broken.
Base64 was the workaround, and MIME standardised it for attachments in 1992. Every photo you've ever emailed made the trip this way, a third larger than it sat on disk.
It never left. Data URIs embed images in stylesheets with it, JSON Web Tokens use the URL-safe variant for each of their three parts, and keys and certificates get passed around as Base64 because they paste into a terminal without breaking.
Base64 vs hex
Both write bytes as text, at different costs. Hex uses two characters per byte, doubling the size. Base64 packs three bytes into four characters, about a third bigger. Hello is 5 bytes: 10 characters in hex, 8 in Base64 with its padding.
Related conversions
Base64, hexadecimal and binary write the same bytes at different densities. Binary takes eight digits for every byte, and Base64 gets that down to about 1.33 characters, with hex in between at two.
For the number behind each character rather than the bytes behind the text, see character codes and Unicode code points.
Questions
Is Base64 encryption?
No. Anyone can decode it, and there's no key to keep secret.
What is URL-safe Base64?
A variant that swaps + for - and / for _, so the result survives a web address without extra escaping. JSON Web Tokens use it.
Why is my output a third bigger?
Four characters carry three bytes. That overhead buys safe passage through systems that only handle text.
Why does my decoded text look garbled?
The bytes probably weren't text. Base64 often carries images, PDFs or keys, and those read as noise.
What's the difference between Base64 and Base64URL?
Base64URL swaps + and / for - and _, which are safe in URLs and file names. Set Variant to URL-safe above to get it. This tool keeps the = padding. JWTs leave it off, so delete any = signs at the end if you need that form.
Is Base64 encryption?
No. Anyone can decode it, with no key. [Encoding vs encryption vs hashing](/encoding-vs-encryption-vs-hashing) explains the difference.
Sources
- RFC 4648: The Base16, Base32, and Base64 Data Encodings
- RFC 1341: MIME (Multipurpose Internet Mail Extensions)
- RFC 7519: JSON Web Token (JWT)
Added . Last updated and reviewed . What's new






