Base64 to ASCII Converter
Convert Base64 encoded strings to ASCII text and ASCII to Base64 online. Supports UTF-8, file upload, copy, and download.
About
Base64 encoding represents binary data using 64 printable ASCII characters (A - Z, a - z, 0 - 9, +, /) plus = for padding. Every 3 input bytes produce 4 Base64 characters, inflating size by approximately 33%. Malformed padding or illegal characters outside the Base64 alphabet will cause silent data corruption in tolerant parsers. This tool uses strict validation: it rejects input containing characters outside the canonical alphabet and verifies that padding conforms to RFC 4648 ยง4 before decoding.
Decoding operates through the native atob function, then pipes the resulting binary string through a TextDecoder set to UTF-8 to handle multi-byte sequences correctly. Encoding reverses the path via TextEncoder and btoa. Note: this tool processes text payloads. Binary files encoded as Base64 will decode to their raw byte representation displayed as text, which may appear garbled for non-text formats.
Formulas
Base64 encoding maps every group of 3 octets (24 bits) into 4 sextets (6 bits each). The output length is computed as:
Where Lin = number of input bytes and Lout = number of Base64 characters including padding. When Lin mod 3 โ 0, padding characters = are appended:
Where P = number of = padding characters (0, 1, or 2). Each Base64 digit maps to a 6-bit value via the index table: A = 0, B = 1, โฆ, / = 63. The decoding reversal extracts 6-bit indices, concatenates them into a bit stream, then splits into 8-bit octets to recover the original bytes.
This means Base64 encoded data is always approximately 33.3% larger than the original binary input.
Reference Data
| ASCII Character | Decimal | Hex | Binary | Base64 Index |
|---|---|---|---|---|
| A | 65 | 0x41 | 01000001 | 0 |
| B | 66 | 0x42 | 01000010 | 1 |
| Z | 90 | 0x5A | 01011010 | 25 |
| a | 97 | 0x61 | 01100001 | 26 |
| z | 122 | 0x7A | 01111010 | 51 |
| 0 | 48 | 0x30 | 00110000 | 52 |
| 9 | 57 | 0x39 | 00111001 | 61 |
| + | 43 | 0x2B | 00101011 | 62 |
| / | 47 | 0x2F | 00101111 | 63 |
| = (pad) | 61 | 0x3D | 00111101 | Padding |
| Space | 32 | 0x20 | 00100000 | - |
| ! | 33 | 0x21 | 00100001 | - |
| ~ | 126 | 0x7E | 01111110 | - |
| DEL | 127 | 0x7F | 01111111 | - |
| NUL | 0 | 0x00 | 00000000 | - |
| TAB | 9 | 0x09 | 00001001 | - |
| LF | 10 | 0x0A | 00001010 | - |
| CR | 13 | 0x0D | 00001101 | - |
| @ | 64 | 0x40 | 01000000 | - |
| # | 35 | 0x23 | 00100011 | - |