Guide
Text as ones and zeros
By Logappradeep · ServiceNow developer
Every piece of text on a computer is ultimately stored as bits, ones and zeros. A binary converter makes that layer visible by writing each byte of a string as eight binary digits. It is a favorite for learning how computers represent data, for checking bit patterns, and for decoding binary messages in puzzles and capture-the-flag challenges.
From character to bits
The conversion has two steps. First, the text is encoded into bytes using UTF-8. Then each byte is written as an 8-bit group, padded with leading zeros so every group has the same width. The letter A is byte 65, which is 01000001, and Hi becomes:
H i
01001000 01101001
Each position is a power of two, from 128 on the left down to 1 on the right. For 01001000, the bits for 64 and 8 are set, and 64 + 8 = 72, the code for H.
What multi-byte characters look like
UTF-8 has a neat structure that becomes obvious in binary. The first bits of each byte tell a decoder how to read it:
0xxxxxxx: a single-byte ASCII character.110xxxxx 10xxxxxx: a two-byte character, such asé=11000011 10101001.1110xxxxfollowed by two continuation bytes: a three-byte character, such as many CJK characters and the euro sign.11110xxxfollowed by three continuation bytes: a four-byte character, such as most emoji.
Every continuation byte begins with 10, which lets a decoder find character boundaries even when it starts reading in the middle of a stream.
Where binary representation matters
- Learning and teaching how encodings, bytes, and bits relate.
- Bit flags and masks, where each bit of a value switches an option on or off.
- Network and protocol work, such as reading header fields or subnet masks bit by bit.
- Puzzles and CTFs, where messages are often hidden as strings of ones and zeros.
Pitfalls
- Leading zeros matter.
1000001and01000001are the same number, but when bytes are run together without spaces, dropping a zero shifts every following bit and scrambles the text. - Whole bytes only. Decoding reads space- or comma-separated groups as bytes, or splits one long run into 8-bit chunks when its length is a multiple of eight. A continuous run of any other length is rejected, because it cannot be divided into whole bytes.
- Binary text is huge. Each byte becomes eight characters plus a separator, about nine times the original size, so it is a display format, not a storage format.
- "Binary file" means something else. A binary file is any non-text file, such as an image or executable, not a file of written ones and zeros.
Everything is converted locally in your browser as you type.