📝 Input
📤 Output
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It works by taking groups of three bytes (24 bits) and splitting them into four 6-bit values, each mapped to one of 64 characters: A–Z, a–z, 0–9, plus sign (+), and forward slash (/). A padding character (=) is used when the input length is not divisible by three.
Base64 encoding was designed to safely transmit binary data through systems that only handle text, such as email (MIME), XML documents, JSON web tokens (JWTs), and data URIs in HTML/CSS. It increases the data size by approximately 33%, which is the trade-off for universal text compatibility.
Common Use Cases for Base64
Developers frequently encounter Base64 in several contexts. Embedding small images directly in HTML or CSS using data URIs avoids additional HTTP requests and can improve page load performance for icons and small graphics. API authentication often uses Base64 — HTTP Basic Authentication encodes the username and password as a Base64 string in the Authorization header. JSON Web Tokens (JWTs) use Base64URL encoding (a URL-safe variant) for their header and payload sections. Email attachments are typically Base64-encoded within MIME messages to ensure binary files survive transmission through text-only email relays.
Base64 vs. Encryption
A common misconception is that Base64 provides security. It does not. Base64 is an encoding scheme, not an encryption algorithm. Anyone can decode a Base64 string without any key or secret. Never use Base64 alone to protect sensitive information like passwords, tokens, or personal data. For actual security, use proper encryption algorithms such as AES or RSA, and established protocols like TLS/HTTPS.
How This Tool Works
This tool uses your browser's built-in btoa() and atob() functions for encoding and decoding, with additional handling for Unicode characters through the TextEncoder and TextDecoder APIs. This ensures full support for non-ASCII characters including emoji, Chinese, Arabic, and other multi-byte character sets. No data is transmitted to any server.