What Is Base64?
Base64 is a binary-to-text encoding scheme that converts binary data into an ASCII string of 64 characters (A-Z, a-z, 0-9, +, /). It was designed to safely transmit binary data through text-only channels like email or URLs.
When to Use Base64
- Embedding small images in CSS or HTML as data URIs
- Encoding binary data in JSON payloads
- Encoding email attachments (MIME)
- Passing binary data in URL query parameters
- Storing binary data in text-only databases or configs
When NOT to Use Base64
- Never for security. Base64 is not encryption — it's trivially reversible
- For large files — Base64 increases size by ~33%
- When the transport already supports binary (like WebSockets in binary mode)
How Base64 Works
The algorithm takes 3 bytes of binary data (24 bits) and splits them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input isn't divisible by 3, padding characters (=) are added.
Base64 Variants
- Standard (RFC 4648): Uses +/ — default everywhere
- URL-safe: Uses -_ instead — safe for URLs and filenames
- MIME: Adds line breaks every 76 characters — used in email
Try It Yourself
Our Base64 Encoder/Decoder lets you encode and decode text instantly in your browser. No data is sent anywhere — perfect for testing with sensitive content.