Base64 encoding is a method of converting binary data into a text format using 64 printable ASCII characters. It was originally designed to allow binary data to be safely transmitted over systems that only handle text.
Why Base64 Exists
Many older internet protocols โ including email (SMTP) and HTTP headers โ were designed to only handle plain ASCII text. When you need to embed binary data like images, files or encryption keys in these systems, Base64 gives you a safe way to do it.
How It Works
Base64 takes every 3 bytes of input and converts them into 4 printable characters. The output is about 33% larger than the input, which is the trade-off for text compatibility.
Common Use Cases
Data URLs in HTML/CSS โ Embedding small images directly in HTML or CSS files without a separate HTTP request:
<img src="data:image/png;base64,iVBORw0KGgoAAAANS...">JSON Web Tokens (JWT) โ The payload and header of a JWT are Base64URL encoded.
Email attachments โ MIME email attachments are Base64 encoded to safely pass through mail servers.
API authentication โ HTTP Basic Authentication sends credentials as Base64 encoded strings.
When NOT to Use Base64
Base64 is NOT encryption. Never use it to "hide" sensitive data โ it can be decoded by anyone instantly. For security, use proper encryption like AES-256.
Try It Now
Use our free Base64 Encoder/Decoder to encode or decode any text instantly in your browser.