Binary to Base64

Convert binary byte strings to Base64 and Base64 back to bits.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

Binary to Base64 Converter

Convert bytes written as binary digits into Base64 and turn Base64 back into 0s and 1s. The tool is useful for students learning how encodings work, for engineers reading bit-level protocol dumps, and for anyone who needs to move a binary bit pattern into a text-friendly format.

Seeing Base64 at the bit level

Base64 is easiest to understand in binary. Every three bytes form 24 bits, and those bits are cut into four 6-bit pieces, each of which picks a character from A–Z a–z 0–9 + /. Take the sample 01001000 01101001 00100001 (the ASCII bytes of Hi!). Regrouped as 010010 000110 100100 100001, the values are 18, 6, 36 and 33, which gives SGkh. When the input is not a multiple of three bytes, the last group is filled with zero bits and = padding is added: the single byte 01001000 becomes SA==.

Accepted input

  • Bytes separated by spaces, commas, semicolons, or new lines: 01001000, 01101001.
  • One continuous bit string whose length is a multiple of 8: 010010000110100100100001.
  • Optional 0b prefixes, as in 0b01001000 0b01101001.

Values must fit in a byte (0–255). Anything else, such as a 2 or a 9-bit number, produces an error that names the invalid token.

Options

URL-safe outputs Base64URL (- and _) for tokens and query strings. When decoding, choose how the bytes are separated: spaces for readability, None for a single continuous bit string, or New line for one byte per line, which is convenient for spreadsheets and test vectors.

Binary is verbose, so most tools display bytes as hex. Use Hex to Base64 for that, or Octal to Base64 for Unix-style octal byte values. To turn readable text into bits, try Text to Binary.

Frequently Asked Questions

When the bytes are separated by spaces, commas, or line breaks, shorter numbers like 1001 are accepted and treated as one byte each. A continuous string without separators must have a length that is a multiple of 8, because it is split into 8-bit groups.

Each group must represent one byte (0–255). A 9-bit value such as 100000000 (256) is rejected with an error showing the offending token, because Base64 encodes a sequence of bytes, not arbitrary integers.

The 24 bits of three bytes are regrouped into four 6-bit chunks, and each chunk (0–63) selects a Base64 character. For 01001000 01101001 00100001 the chunks are 010010 000110 100100 100001, which map to S, G, k and h: SGkh.