Base64 Encoder & Decoder
Convert text to Base64 encoding or decode Base64 strings instantly. No external dependencies required.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It uses a 64-character alphabet consisting of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two special characters (+ and /). Base64 encoding is commonly used in web development, email systems, and data transmission to ensure that binary data can be safely transmitted over systems that only handle text.
How Base64 Works
Base64 encoding works by taking binary data and converting it into a text string using 64 safe ASCII characters. Here's the process:
- Grouping: The binary data is divided into 6-bit groups
- Mapping: Each 6-bit group is mapped to a corresponding Base64 character
- Padding: If the input isn't divisible by 3 bytes, padding characters (=) are added to make the output length a multiple of 4
- Output: The result is a Base64 string that can be safely transmitted or stored
Decoding reverses this process: the Base64 characters are converted back to their 6-bit binary equivalents, which are then regrouped into 8-bit bytes to recover the original data.
Common Uses for Base64
- Email Systems: Email protocols use Base64 to encode attachments and non-ASCII characters
- Data URLs: Embedding images in HTML or CSS using data URLs with Base64 encoding
- JSON Web Tokens (JWT): JWTs use Base64 encoding for the header and payload sections
- API Authentication: Basic HTTP authentication uses Base64 to encode username and password
- Obfuscation: Simple text obfuscation for non-sensitive data
- File Storage: Converting binary files to text format for storage in text-based systems