About Base64 Encoding and Decoding
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used when there is a need to encode binary data that needs to be stored and transferred over media designed to deal with text.
Common Use Cases for Base64
Data URLs
Embed images or other binary data directly in HTML or CSS files using Base64 encoded data URLs. This eliminates the need for separate file requests.
Email Attachments
Email systems use Base64 to encode binary attachments for transmission over SMTP protocols which were originally designed for text-only transmission.
API Authentication
Basic authentication headers in HTTP requests often use Base64 encoded username:password combinations for simple authentication.
Storing Binary Data
Databases or systems that only accept text can store binary data as Base64 strings, making it possible to store images, documents, and other binary files in text fields.
How to Use This Base64 Tool
- For text encoding/decoding: Select the "Text" tab, enter your text, and click "Encode to Base64" or "Decode from Base64"
- For file encoding: Select the "File" tab, upload your file (up to 10MB), and click "Encode File to Base64"
- Copy the result using the "Copy to Clipboard" button
- Use the "Clear" buttons to reset the tool and start over
Technical Details of Base64 Encoding
Base64 encoding works by dividing the input bytes into groups of 3 bytes (24 bits) and representing each group as 4 printable characters from the Base64 alphabet. The Base64 alphabet consists of:
- Uppercase letters A-Z
- Lowercase letters a-z
- Digits 0-9
- Special characters '+' and '/'
- The '=' character is used for padding
This encoding increases the size of the data by approximately 33% compared to the original binary data. For example, 3 bytes of binary data become 4 ASCII characters.