Base64 Encoder & Decoder
Convert text to Base64 strings or decode Base64 back to readable text securely in your browser. Supports UTF-8 characters and handles binary data encoding.
About
Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. Each Base64 digit represents exactly 6 bits of data.
This tool is essential for developers working with data transmission over protocols that are designed to handle text, such as SMTP (email) or HTTP. It is frequently used to embed image data directly into HTML or CSS files to reduce HTTP requests, or to encode complex strings (like API keys or tokens) to ensure they travel safely across different systems without character encoding issues.
Formulas
The Base64 encoding process transforms data by breaking binary inputs into 6-bit segments. Unlike a mathematical formula, this is an algorithmic transformation.
- Step 1. Take the ASCII/UTF-8 byte values of the input string.
- Step 2. Concatenate the binary representations of these bytes into a continuous stream.
- Step 3. Divide this stream into groups of 6 bits.
- Step 4. Map each 6-bit value (0-63) to the Base64 alphabet: A-Z, a-z, 0-9, +, /.
- Step 5. If the total bits are not divisible by 24 (3 bytes), append padding characters (
=) to complete the block.
Decoding reverses this process: mapping characters back to 6-bit values, combining them, and regrouping into 8-bit bytes to reconstruct the original data.
Reference Data
| Index (Decimal) | Binary (6-bit) | Char | Index (Decimal) | Binary (6-bit) | Char |
|---|---|---|---|---|---|
| 0 | 000000 | A | 30 | 011110 | e |
| 1 | 000001 | B | 40 | 101000 | o |
| 25 | 011001 | Z | 50 | 110010 | y |
| 26 | 011010 | a | 62 | 111110 | + |
| 27 | 011011 | b | 63 | 111111 | / |