What is Base64?
Base64 (also written as base 64 or b64) is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. It was designed to safely transmit binary content through text-based channels — like email or JSON — that might corrupt raw bytes.
Is Base64 decoding the same as decryption?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly — there is no key, no secret, and no security. It is a reversible format change, not a way to protect data. If you received a Base64 string, paste it into the decoder above to read it. If you need to protect sensitive data, use proper encryption (AES, RSA, etc.).
When to use Base64 encoding
- Embedding images in HTML or CSS — encode a small image as a data URI (
data:image/png;base64,…) to avoid an extra HTTP request. - JWT tokens — JSON Web Tokens use Base64URL (a variant) to encode the header and payload sections.
- MIME email attachments — email protocols were designed for ASCII text; Base64 encodes attachments for safe transit.
- Storing binary data in JSON — JSON has no native binary type, so Base64 is the standard workaround.
- HTTP Basic Auth — credentials are sent as
Base64(username:password)in the Authorization header.
How Base64 encoding works
Every 3 bytes of input are split into 4 groups of 6 bits. Each group maps to a character in the Base64 alphabet. If the input isn't a multiple of 3 bytes, = or == padding is added so the output length is always a multiple of 4 characters. Decoding reverses this exactly.
Base64 vs. Base64URL
Standard Base64 uses + and / which have special meaning in URLs. Base64URL replaces them with - and _ and omits the = padding — making it safe in URLs and filenames. JWTs and OAuth tokens use Base64URL; this tool uses standard Base64.
Frequently asked questions
What does Base64 decode do?
Base64 decode converts a Base64-encoded string back to its original form — plain text, binary data, or whatever was encoded. Paste the b64 string into the tool above with Decode selected. If the string ends in = or ==, it is definitely Base64-encoded.
What is b64?
b64 is an informal abbreviation for Base64. You'll see it in config files, environment variables, and developer shorthand. It refers to the same encoding scheme — 64-character alphabet, 4-characters-per-3-bytes, with optional = padding.
How do I encode a string to Base64 in code?
In JavaScript: btoa("hello") encodes, atob("aGVsbG8=") decodes. In Python: import base64; base64.b64encode(b"hello"). In bash: echo -n "hello" | base64 to encode, echo "aGVsbG8=" | base64 -d to decode.
Why does Base64 output end with = or ==?
Base64 encodes 3 bytes into 4 characters. When the input length isn't divisible by 3, one or two = padding characters are added to make the output length a multiple of 4. One = means one padding byte; == means two. Some implementations (including Base64URL) omit padding entirely.