Base64 Encoding Explained: A Developer's Practical Guide
What is Base64, why does it exist, and when should you use it? A clear explanation with examples every developer can understand.

Base64 is one of those encoding schemes every developer encounters but few fully understand. You've seen it in image src attributes, JSON Web Tokens, email attachments, and API authentication headers. Here's what it actually is and why it exists.
What Is Base64?
Base64 is a binary-to-text encoding scheme. It converts binary data (bytes) into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). The result is safe to transmit anywhere text is accepted — even channels that would corrupt raw binary.
Why Does Base64 Exist?
Many systems were designed to handle text only. Email protocols (SMTP), HTTP headers, and XML parsers can choke on raw binary. Base64 solves this by representing any binary data as plain text.
The trade-off: Base64-encoded data is roughly 33% larger than the original binary.
How It Works (Simply)
Every 3 bytes of input become 4 Base64 characters. The 24 bits across 3 bytes are split into four 6-bit groups, each mapped to one of 64 characters.
Input: "Man" → 77 97 110 → 01001101 01100001 01101110
Split: 010011 010110 000101 101110
Output: T W F uIf the input isn't divisible by 3, = padding characters are added.
Common Use Cases
Images in HTML/CSS. Embed small images directly: <img src="data:image/png;base64,iVBOR...">
JWT tokens. JSON Web Tokens use Base64url (a URL-safe variant) for their header and payload sections.
HTTP Basic Auth. Credentials are Base64-encoded: Authorization: Basic dXNlcjpwYXNz
Email attachments. MIME encodes non-text attachments in Base64 for transport.
API responses. Some APIs return binary data (PDFs, images) Base64-encoded in JSON payloads.
Base64 Is NOT Encryption
This is the most important thing to understand. Base64 is trivially reversible — anyone can decode it instantly. Never use it to "hide" sensitive data. It's an encoding scheme for transport compatibility, not security.
Encode and Decode Instantly
Our tool handles encoding and decoding in your browser — no server involved, your data stays private.