Convert binary to text
Text in a binary stream is a sequence of character codes.
To read it, split the bits into groups of 8, then read each group as a number.
Each number is the code of one character.
Try binary to text conversion in the bit editor
The bits 01000001, which give the character A. Edit the expression or select a bit to flip it.
7
6
5
4
3
2
1
0
A
text · 8 bits
- value
- 65
- hex
- 0x41
Byte order
Binary to text conversion step by step
Read each byte of the value above as a character: The steps follow the value above.
- The byte 01000001 is 65, which is the character A.
- The text is A.
The character of each code in common use
| Character | Decimal | Hex | Binary |
|---|---|---|---|
| 13 | 0x0D | 00001101 | |
| 10 | 0x0A | 00001010 | |
| space | 32 | 0x20 | 00100000 |
| 0 | 48 | 0x30 | 00110000 |
| A | 65 | 0x41 | 01000001 |
| a | 97 | 0x61 | 01100001 |
| ~ | 126 | 0x7E | 01111110 |
Where binary to text conversion is used
A serial monitor converts every byte it receives to a character.
A hex dump of a file shows the bytes and the characters side by side.
A field of a protocol frame often holds text next to a numeric field.
Binary to text conversion: points to note
- A group of 8 bits is one byte. A stream with a length that 8 does not divide has a partial byte at the end.
- A code below 32 is a control code with no shape. Beetwise shows a dot for it.
- The code 13 is a carriage return and the code 10 is a line feed. Both end a line, and Windows uses the pair.
- A byte above 127 is not valid ASCII, so the character depends on the code page.
The full bit editor
The full editor holds many values, evaluates expressions across them, and reads live values from a serial port.
Open this value in the full editorQuestions about binary to text conversion
- What is 01000001 in text?
- The bits 01000001 give 65, which is the character A.
- Why does my text show dots?
- A dot marks a byte outside the printable range 32 to 126, such as a control code.
- How do I read a 16-bit value as text?
- Split it into two bytes. Each byte gives one character, and the byte order decides which character comes first.