Binary to Base64, bit by bit
The binary to Base64 converter reads your 0s and 1s as bytes and encodes them as Base64. It is a great way to see how Base64 really works, because Base64 is itself defined in terms of bits: it regroups the input into 6-bit chunks and maps each chunk to one of 64 characters.
Example
Input:
01001000 01101001 00100001Output:
SGkh
How the bits become characters
The three input bytes are joined into one 24-bit stream and cut into four 6-bit groups:
| 6-bit group | Value | Character |
|---|---|---|
010010 | 18 | S |
000110 | 6 | G |
100100 | 36 | k |
100001 | 33 | h |
Values 0–25 map to A–Z, 26–51 to a–z, 52–61 to 0–9, 62 to + and 63 to /. When the input is not a multiple of three bytes, the last group is padded with zero bits and = signs are added to the output.
The Base64 alphabet was chosen so that all 64 characters are printable and survive transport through email systems, terminals and older character sets. Six bits per character is the largest power of two for which that is possible.
Padding in action
With only two bytes, “Hi” gives 16 bits. Base64 needs a multiple of 6, so two zero bits are appended: 010010 000110 100100 becomes SGk, and one = marks the missing third byte, giving SGk=. A decoder drops the padding bits again, so no data is added.
Where + and / come from
Only two 6-bit groups produce the characters that cause trouble in URLs: 111110 (62) becomes + and 111111 (63) becomes /. You can see both with two bytes full of ones:
11111011 11111111
→ 111110 111111 1111(00)
→ + / 8 Base64: +/8=
Base64URL: -_8Base64URL swaps those two characters for - and _ and usually drops the = padding, which is why JWTs and URL parameters use it. A single byte such as 01000001 (the letter A) shows the other padding case: 010000 01(0000) gives QQ==, with two padding signs because two bytes are missing from the final group.
Accepted input
- Bytes separated by spaces, commas, semicolons or line breaks.
- One continuous bit string whose length is a multiple of 8 — it is split into bytes automatically.
- Groups shorter than 8 bits when separated (for example 1001000), which are read as the byte value.
Any group that is not binary, or whose value exceeds 255, is reported as an error so nothing is silently misread.
Uses
Besides teaching and exam practice, the tool helps when you design bit-level protocols, compose flag bytes or test decoders with precise inputs. If you have text rather than bits, convert it first with Text to Binary, or encode it directly with the Base64 Encoder.
Convert Base64 back into bits with Base64 to Binary. Everything runs in your browser.