What is Base64?
Base64 is a binary-to-text encoding scheme that converts binary data into a string made up of 64 printable ASCII characters. The "64" in the name refers to the size of this character set — 64 symbols that can be safely transmitted through systems that only handle plain text.
It was designed to solve a fundamental compatibility problem: many protocols and systems (email, JSON, XML, HTTP headers) are built for text. But images, audio files, certificates, and executable binaries are binary data — they contain bytes that have no printable representation. Base64 bridges that gap by representing any binary data using only printable characters.
Base64 takes any binary data and turns it into a string of safe, printable text — so it can travel through text-only systems without getting corrupted.
Encode any text to Base64 or decode any Base64 string — free, browser-only, instant results.
Open Base64 Tool →The Base64 Character Set
Base64 uses exactly 64 characters — 26 uppercase letters, 26 lowercase letters, 10 digits, and 2 symbols (+ and /). A 65th character — the equals sign (=) — is used as padding and is not part of the encoding alphabet itself.
How Base64 Encoding Works
Base64 encodes data in groups of 3 bytes (24 bits) at a time, converting each group into 4 Base64 characters (6 bits each). Here's how "Man" is encoded step by step:
So "Man" (3 bytes) encodes to "TWFu" (4 characters). Every 3 bytes of input produces exactly 4 characters of Base64 output — a 4:3 ratio, which is why Base64 data is always about 33% larger than the original.
If the input length is not a multiple of 3, padding characters (=) are added. 1 remaining byte → 2 Base64 chars + == padding. 2 remaining bytes → 3 Base64 chars + = padding.
Live Encode / Decode Tool
Type or paste text below to encode or decode Base64 instantly:
Real-World Use Cases
Base64 appears in more places than most developers realise:
Email Attachments
MIME encoding uses Base64 to embed binary attachments (PDFs, images) in plain-text email messages.
Inline Images (Data URIs)
Embed images directly in HTML or CSS without extra HTTP requests using data:image/png;base64,...
HTTP Basic Auth
The Authorization header encodes credentials as Base64: Authorization: Basic dXNlcjpwYXNz
JWT Tokens
JSON Web Tokens use Base64URL (a URL-safe variant) to encode the header and payload sections.
API Keys & Secrets
Many API platforms encode keys and secrets as Base64 strings for transmission through HTTP headers.
SSL Certificates
PEM-format certificates (.pem, .crt) are Base64-encoded DER files wrapped in -----BEGIN CERTIFICATE----- headers.
Size Overhead
Base64 encoding always increases data size by approximately 33%. This is an inherent cost of representing 3 bytes as 4 characters.
| Original data | Original size | Base64 size | Increase |
|---|---|---|---|
| Small API token | 30 bytes | ~40 chars | +33% |
| Thumbnail image | 10 KB | ~13.3 KB | +33% |
| Profile photo | 100 KB | ~133 KB | +33% |
| PDF document | 1 MB | ~1.33 MB | +33% |
Inlining large images as Base64 data URIs increases HTML/CSS file size significantly and can slow page load. Only use Base64 for small icons and images — serve large images as separate files.
Base64 vs Encryption — A Critical Difference
This is one of the most important things to understand about Base64: Base64 is not encryption. It provides zero security.
- Base64 is reversible by anyone — any tool can decode it in milliseconds with no key or password required.
- Base64 is encoding, not encryption — it changes the representation of data, not its confidentiality.
- Never use Base64 to hide passwords, tokens, or sensitive data — it offers no protection.
- HTTP Basic Auth is not secure by itself — the Base64-encoded credentials can be decoded instantly. It only provides security when transmitted over HTTPS.
Storing passwords, API secrets, or personal data as Base64 in source code or databases provides no security whatsoever. Use proper encryption (AES, RSA) or hashing (bcrypt, Argon2) for sensitive data.
Base64 in Code
Every major language has built-in Base64 support. Here are the most common patterns:
JavaScript (Browser)
Python
Node.js
PHP
Encode or decode Base64 instantly — no code needed. Free, browser-only, nothing transmitted.
Open Base64 Tool →Frequently Asked Questions
Conclusion
Base64 is one of those foundational encoding schemes that powers a surprising amount of everyday web infrastructure — email attachments, JWT authentication, inline images, SSL certificates, and HTTP auth headers all rely on it. Understanding how it works makes debugging API responses, reading log files, and working with binary data significantly easier.
The most important thing to remember: Base64 is encoding, not encryption. It changes how data is represented, not how secure it is.
Encode text to Base64 or decode any Base64 string instantly — browser-only, free, nothing transmitted.
Open Base64 Tool →