Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 back to readable text. All processing is done locally in your browser.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format using a radix-64 representation. It is commonly used to transmit data over media that are designed to handle textual content, such as email attachments via MIME, storing complex data in JSON or XML, and embedding images directly in HTML or CSS as data URIs.
The encoding process takes three bytes of binary data and converts them into four ASCII characters from a set of 64 characters (A-Z, a-z, 0-9, +, /). The = character is used for padding at the end to ensure the encoded output length is a multiple of four. While Base64 increases data size by approximately 33 percent compared to the original binary, the benefit is that the output can be safely transmitted through systems that might otherwise misinterpret binary data.
How to Use This Tool
Type or paste text into the input field and click Encode to Base64 to convert it. To reverse the process, paste a Base64 string and click Decode from Base64. The tool handles standard Base64 encoding with proper Unicode support. For non-ASCII characters, it first encodes the string as UTF-8 before applying Base64, ensuring that international characters and symbols are preserved correctly.
The output area displays the result in a monospaced font for easy reading and copying. Use the Copy Output button to copy the result to your clipboard with a single click.
Common Uses for Base64
- Email Attachments: MIME encoding uses Base64 to send binary attachments via SMTP, which is a text-only protocol.
- Data URIs in Web Pages: Small images, fonts, or other assets can be embedded directly in HTML or CSS using Base64 data URIs, reducing HTTP requests.
- API Authentication: Basic HTTP authentication uses Base64 to encode username and password pairs in the Authorization header.
- Storing Binary in Databases: When binary data must be stored in text-based fields (JSON, XML, CSV), Base64 provides a safe encoding.
- Cryptographic Operations: Keys, certificates, and signatures are often distributed in Base64-encoded formats like PEM.
Base64 vs Other Encoding Schemes
Base64 is not the only binary-to-text encoding scheme, but it is the most widely used. Base32 uses a 32-character set and produces output that is about 40 percent larger than the input, but it is case-insensitive and easier for humans to read and transcribe. Base16 (hexadecimal) is even less efficient, doubling the data size, but it is the most straightforward for debugging. Base64 strikes a practical balance between efficiency and readability, which is why it has become the standard choice for most applications.