Base64 Encoder / Decoder
Encode your text and data into a Base64 string, or decode a Base64 string back to its original form. Perfect for handling binary data in text-based formats.
About Our Base64 Encoder / Decoder
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. It is designed to carry data that needs to be stored and transferred over media that are designed to deal with text. This ensures that the data remains intact without modification during transport.
How Does It Work?
The Base64 alphabet consists of 64 characters: 26 uppercase letters (A-Z), 26 lowercase letters (a-z), 10 digits (0-9), and two special characters, typically '+' and '/'. The encoding process takes 3 bytes of binary data (24 bits) and represents them as 4 printable ASCII characters (6 bits each), making it safe for text-based transmission.
How It Works
- Paste Your String: Enter the text you want to process into the input field.
- Choose an Action: Click 'Encode' to convert it to Base64, or 'Decode' to convert a Base64 string back to its original form.
- Copy the Result: The processed string will appear in the output field, ready to be copied.
Practical Use Cases
1. Embedding Images in HTML/CSS (Data URIs)
One of the most common uses for Base64 is to embed small images or other binary files directly into HTML or CSS files. This is known as a Data URI (e.g., <img src="data:image/png;base64,iVBORw0KGgo...">
). It eliminates the need for an extra HTTP request to fetch the image, which can be useful for small icons or critical assets.
2. Basic HTTP Authentication
The "Basic" HTTP authentication scheme sends user credentials in the request header. The username and password are combined into a "username:password" string, which is then Base64 encoded before being sent. Note that this is encoding, not encryption, and is not considered secure over non-HTTPS connections.
3. Transmitting Binary Data in JSON/XML
Formats like JSON and XML are text-based and cannot natively handle binary data (like the content of a file). To include binary data, it must first be Base64 encoded into a string, which can then be safely included as a value in a JSON object or XML element.
Frequently Asked Questions
Have questions? We have answers.