Loading...
Loading...
At its core, Base64 is a way to represent binary data (like images, files, or even raw bytes) as plain text. This is crucial because many systems, especially older ones or those built on text-based protocols (like email via SMTP or data in JSON/XML), are designed to handle only text characters.
If you try to send binary data through these systems, it can be misinterpreted as control characters, leading to data corruption. Base64 solves this by converting the binary data into a safe, universal subset of ASCII characters that every system can understand.
Base64 works by taking 3 bytes (24 bits) of binary data and representing them as 4 text characters (4 x 6 bits = 24 bits).
Example: Encoding the word "Man"
01001101 01100001 01101110.010011010110000101101110.010011 (19), 010110 (22), 000101 (5), 101110 (46).Thus, "Man" becomes "TWFu". Try encoding this yourself with our text encoder!
What happens if the input data isn't a perfect multiple of 3 bytes? This is where padding comes in.
= for padding.==.While the logic is the same, the 64-character alphabet can vary slightly. You can experiment with different variants using our encoder tool and comparison tool to see the differences side by side.
| Variant | Characters 62 & 63 | Use Case |
|---|---|---|
| Standard (RFC 4648) | + and / | General purpose, used in email (MIME). |
| URL & Filename Safe | - and _ | Used where '+' and '/' have special meaning, like in URLs and file paths. |
data:image/png;base64,.... Convert images to Data URIs with our image converter.Now that you understand how Base64 works, explore our tools to put your knowledge into practice:
Privacy Notice: All encoding and decoding happens directly in your browser. Your data never leaves your device. Learn more about our commitment to privacy.