Online Binary encode & decode

Each character from U+0000 through U+00FF becomes eight bits, high bit first, with a space between characters. H is 01001000 and i is 01101001, so Hi is those two groups. A code point above U+00FF, including ordinary Chinese, has no group here. Decoding accepts only groups of exactly eight digits, each a 0 or a 1. A missing leading zero, a ninth bit, or a run of bits with no spaces is not a byte. For ASCII these eight bits match the UTF-8 byte. For é they are the single code point E9, not the two UTF-8 bytes C3 A9.

What eight bits stand for when a character is at most U+00FF

A character whose code point is U+0000 through U+00FF is one byte, and these bits write that byte with the high bit first. H is 72 in decimal and 48 in hex, so the bits are 01001000. i is 01101001. Hi is the two groups 01001000 01101001, with a space between them. Values under 128 always start with 0, because the high bit of a seven-bit ASCII character is zero. Dropping that zero leaves seven bits, which is not this byte.

Decoding treats whitespace as the boundary between bytes. Each group must be exactly eight characters, and every character must be 0 or 1. 01001000 is H. 1001000 is the same integer with the leading zero removed, and it is not a group. 010010000 is nine bits. 0100100001101001 is sixteen bits with no space, so it is not the two bytes of Hi. A 0b prefix is a programming mark, not a bit.

For ASCII the byte is also the UTF-8 byte, so the same Hi is 48 69 in hex encode and decode and SGk= in Base64. A code point above U+00FF has no eight-bit group here. é is U+00E9, still inside the range, and its eight bits are 11101001, the single value E9. UTF-8 stores é as the two bytes C3 A9. Those bits are 11000011 10101001, which is a different spelling of the same character.

How eight bits, the space, and UTF-8 bytes line up

Why a character from U+0000 through U+00FF is exactly eight bits

  1. The code point is the byte. 0 through 255 fill eight bits, and the left-most bit is the 128s place.
  2. ASCII lives in 0 through 127, so the left-most bit is 0. A is 01000001, not 1000001. The shorter form is the same integer and a different length.
  3. One character is one group. Hi is two groups because it is two characters. The space marks that boundary. It is not a ninth bit.

Why a group fails when the length is not eight or the bits are not split

  1. A group is exactly eight digits, each 0 or 1. Seven digits, nine digits, or a 2 anywhere is not a byte in this spelling.
  2. Spaces, tabs, and line breaks separate groups. A continuous run is a single group. A run longer than eight digits is rejected rather than cut every eight digits.
  3. 0b01001000 puts a prefix in front of the bits. The b is not a binary digit. The eight bits of H begin only after that prefix is gone.

How these bits differ from hex and from the UTF-8 bytes of the same character

  1. Hex writes the same byte as two digits. 01001000 is 48 and 01101001 is 69. For ASCII the hex dump and these groups list the same bytes.
  2. Base64 groups six bits. It is a shorter spelling of those same ASCII bytes. Hi is SGk= there and 01001000 01101001 here.
  3. é is inside U+00FF, so it is one group, 11101001. UTF-8 stores é as C3 A9, two bytes, 11000011 10101001. That pair is not the one group above.

Why a character above U+00FF has no eight-bit group in this spelling

  1. Eight bits stop at 255. A CJK ideograph, an emoji, or any code point from U+0100 upward does not fit in one byte of this kind.
  2. UTF-8 would spread that character across two, three, or four bytes. This spelling does not make that split, so there is no group to emit.
  3. The UTF-8 bits of U+4E2D are 11100100 10111000 10101101, three bytes. Reading each group as a character from U+0000 through U+00FF does not rebuild the ideograph.

Where eight-bit groups are bytes and not the UTF-8 people expect

An ASCII word sitting next to its hex dump

Hi is the bytes 48 and 69. In bits that is 01001000 01101001. In hex it is 4869, two digits per byte, which is the subject of hex encode and decode. The space in the bit string is the same boundary as the boundary between 48 and 69. Removing the space glues the two bytes into one illegal group.

A bit string copied from a loop that printed digits with no gap

A program that prints each bit in a row produces 0100100001101001 for Hi. That is sixteen digits and one group, so it is not two bytes. The same bits with a space after the eighth digit are 01001000 01101001, which is Hi. The digits did not change. Only the boundary did.

A character someone expected to see as UTF-8 bits

é is one code point, U+00E9, and one group, 11101001. Its UTF-8 form is two bytes, C3 A9. A CJK ideograph is three UTF-8 bytes and does not fit in U+00FF at all. Those multi-byte sequences are a byte dump, which belongs with hex encode and decode, not one eight-bit group per character. The same ASCII bytes in a shorter alphabet are Base64.

Common questions

What is binary encoding of text?
It writes each character from U+0000 through U+00FF as eight bits, high bit first, with a space between characters. The bits are the numeric value of that character, from 0 through 255. Hi becomes 01001000 01101001. The mapping is public. It does not hide the character. A code point above 255 has no group in this spelling.
Why does each letter become eight bits with a leading zero?
A byte has eight bits even when the value is below 128. ASCII letters sit in that lower half, so the high bit is 0. A is 65, which is 01000001, not the seven digits 1000001. The short form is the same number and a different length. A group of seven digits is not a byte here, so the leading zero has to stay.
What character is 01001000?
01001000 is the byte 72 in decimal and 48 in hex. That value is the character H. The left-most bit is the high bit, so 01001000 is not the same byte as 00010010. i is the next group, 01101001. Together, with one space, they are Hi. Without the space they are sixteen bits and not a character.
Why does a binary string fail when there are no spaces?
The space is the boundary between bytes. Each group has to be exactly eight digits. 0100100001101001 is one run of sixteen digits, so it is not the two bytes of Hi. Cutting it by hand every eight digits restores 01001000 01101001. Leaving it as one run does not. Tabs and line breaks count as the same kind of boundary as a space.
Why can a Chinese character not be turned into this binary?
This spelling only has room for code points U+0000 through U+00FF, one byte each. A typical ideograph is far above 255. UTF-8 would encode it as three bytes, for example 11100100 10111000 10101101 for U+4E2D. Those three groups are a byte dump. Read back as characters in the 0 through 255 range, they are not the ideograph. There is no single eight-bit group for that character.
What is the difference between binary and hexadecimal?
Both can list the same byte. Binary uses eight digits of 0 and 1. Hex uses two digits of 0 through 9 and A through F. 01001000 and 48 are the byte of H. The hex form is shorter and easier to scan. The bit form shows each place value. For ASCII they match. A multi-byte UTF-8 sequence is still a byte dump, which is the subject of hex encode and decode.
Why is é one group here but two bytes in UTF-8?
é is the code point U+00E9, which is 233, still inside a single byte. These eight bits are 11101001. UTF-8 does not store that code point as the byte E9. It stores the two bytes C3 A9, whose bits are 11000011 10101001. Decoding 11101001 as text yields é. Decoding the two UTF-8 bytes as two groups yields two different characters, not one é.
Does a 0b prefix belong in the bits?
No. 0b is how some programming languages mark a binary integer. It is not the first two bits of the byte. 0b01001000 is the prefix plus the eight bits of H. The b is not 0 or 1, so the whole string is not a group. The byte itself is 01001000. The same idea applies to a 0x prefix on a hex byte: the mark is not data.