Binary to Base64 Converter
Convert binary strings to Base64 and Base64 back to binary instantly. Supports 8-bit byte validation, copy, download, and bidirectional conversion.
About
Binary and Base64 are two fundamentally different encoding schemes for representing raw byte data as text. Binary notation expresses each byte as 8 bits (e.g., 01001000 for the ASCII character H), while Base64 maps every group of 3 bytes (24 bits) into 4 printable ASCII characters drawn from a 64-symbol alphabet (A - Z, a - z, 0 - 9, +, /). Misaligned bit grouping is the most common source of corruption: if your binary string length is not divisible by 8, the trailing bits produce an invalid byte and the entire output is wrong. This tool validates alignment before conversion.
The converter handles both directions. It groups binary digits into octets, computes each byte value, then applies RFC 4648 Base64 encoding. The reverse path decodes each Base64 character back to its 6-bit index, reconstructs bytes, and formats them as zero-padded 8-bit binary strings. Note: this tool operates on raw byte data. It does not interpret character encodings beyond ASCII/Latin-1 in the Base64 path. For multi-byte UTF-8 sequences, encode the UTF-8 bytes in binary first.
Formulas
Base64 encoding operates on groups of 3 bytes (24 bits), splitting them into 4 sextets of 6 bits each. Each sextet indexes into the Base64 alphabet to produce one output character.
For every 8-bit binary chunk, the decimal byte value is computed by interpreting the string as a base-2 integer.
The assembled bytes form a raw binary string, which is then encoded using the standard Base64 algorithm per RFC 4648.
Where n is the number of input bytes. When n is not divisible by 3, padding characters (=) are appended: 1 remainder byte produces 2 padding chars, 2 remainder bytes produce 1.
The reverse conversion decodes each Base64 character back to its 6-bit value, reconstructs 8-bit bytes, then formats each byte as a zero-padded binary string:
Where charCodei is the byte value from the decoded Base64 string at position i.
Reference Data
| ASCII Character | Decimal | Binary (8-bit) | Base64 (solo byte) |
|---|---|---|---|
| NUL | 0 | 00000000 | AA== |
| TAB | 9 | 00001001 | CQ== |
| LF (\n) | 10 | 00001010 | Cg== |
| Space | 32 | 00100000 | IA== |
| 0 | 48 | 00110000 | MA== |
| 9 | 57 | 00111001 | OQ== |
| A | 65 | 01000001 | QQ== |
| B | 66 | 01000010 | Qg== |
| Z | 90 | 01011010 | Wg== |
| a | 97 | 01100001 | YQ== |
| z | 122 | 01111010 | eg== |
| + | 43 | 00101011 | Kw== |
| / | 47 | 00101111 | Lw== |
| = | 61 | 00111101 | PQ== |
| ~ | 126 | 01111110 | fg== |
| DEL | 127 | 01111111 | fw== |
| Γ | 201 | 11001001 | yQ== |
| ΓΌ | 252 | 11111100 | /A== |
| xFF | 255 | 11111111 | /w== |
| Hi (2 bytes) | 72, 105 | 01001000 01101001 | SGk= |
| Man (3 bytes) | 77, 97, 110 | 01001101 01100001 01101110 | TWFu |