What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into 64 printable ASCII characters. It is widely used in web development, email systems (MIME), and data storage to safely transmit binary data through text-only channels.
Common Use Cases
- Embedding images in HTML/CSS using data URIs
- Encoding email attachments (MIME)
- Storing complex data in JSON or XML
- HTTP Basic Authentication headers
- JSON Web Tokens (JWT)
How It Works
Base64 takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits. Each 6-bit group maps to one of 64 characters: A-Z, a-z, 0-9, +, and /. The = character is used for padding. This means Base64-encoded data is approximately 33% larger than the original.