Base64 is one of those things every developer uses but few fully understand. It's not encryption, it's not compression -- it's a binary-to-text encoding scheme that solves a specific problem.
The problem Base64 solves: Binary data contains bytes that some systems interpret as control characters. An email attachment, an image in an HTML email, or a certificate in a text config file -- all of these need a way to represent binary data using only safe printable characters.
How it works: Every 3 bytes of input become 4 characters of output. The algorithm takes 24 bits (3 bytes), splits them into four 6-bit groups, and maps each 6-bit value (0-63) to a character in the Base64 alphabet (A-Z, a-z, 0-9, +, /). This means Base64 output is about 33% larger than the input.
When to use it: Embedding images in HTML or CSS (data URIs), attaching files to emails, storing binary data in JSON, encoding API keys or tokens for transmission.
When NOT to use it: Don't use Base64 for encryption (it's encoding, not encryption). Don't use it to make data smaller (it makes it bigger). Don't use it when you can just send binary data directly.
Base64 URL-safe variant: Standard Base64 uses + and / which need URL-encoding. Base64URL uses - and _ instead, making it safe for URLs and filenames. JWT tokens use this variant.
Use our encoder/decoder to see the exact transformation with any input.