Base64 Encoder/Decoder
Encode and decode Base64 strings quickly and securely
Base64 encoding is commonly used for encoding binary data in email attachments, data URLs, and storing complex data in formats that require text. This tool handles UTF-8 text encoding properly.
Encode to Base64
Convert plain text to Base64 encoded string
UTF-8 Safe
URL Safe
Decode from Base64
Convert Base64 encoded string back to plain text
Error Handling
Unicode Support
About Base64 Encoding
Base64 is a binary-to-text encoding scheme that represents binary data using only ASCII characters. It's commonly used in web development, email systems, and data storage where binary data needs to be transmitted over text-based protocols.
Common Use Cases:
- Embedding images in HTML/CSS (data URLs)
- Email attachments (MIME encoding)
- Storing binary data in JSON or XML
- Authentication tokens and API keys
- Encoding files for web transmission
💡 Note: Base64 encoding increases the size of data by approximately 33%. It's not encryption or compression - anyone can decode Base64 strings.
Usage Examples
JavaScript
// Encoding
const encoded = btoa("Hello World!");
console.log(encoded); // SGVsbG8gV29ybGQh
// Decoding
const decoded = atob("SGVsbG8gV29ybGQh");
console.log(decoded); // Hello World!
// For UTF-8 support (like this tool)
const encoded = btoa(unescape(encodeURIComponent("Hello 🌍!")));
const decoded = decodeURIComponent(escape(atob(encoded)));
Data URL Example
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." />
<!-- Or with CSS -->
.background {
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aW...');
}