What is binary?
Binary is a number system that uses only two digits, 0 and 1. Computers use it because their circuits have two states, on and off. Each 0 or 1 is called a bit, and eight bits make a byte. One byte can hold 256 different values, from 0 to 255.
Computers store text by giving every character a number and writing that number in binary. When you convert binary to text, you are reversing that process: reading the numbers and looking up which characters they stand for.
How binary maps to text
ASCII is the best-known mapping. It assigns the numbers 0 to 127 to English letters, digits, punctuation and a few control codes. For example, uppercase A is 65 and lowercase a is 97. The table below shows common characters in decimal, hexadecimal and 8-bit binary.
Common ASCII characters in decimal, hexadecimal and binary| Character | Decimal | Hex | Binary |
|---|
| A | 65 | 41 | 01000001 |
| B | 66 | 42 | 01000010 |
| H | 72 | 48 | 01001000 |
| a | 97 | 61 | 01100001 |
| z | 122 | 7A | 01111010 |
| 0 | 48 | 30 | 00110000 |
| 9 | 57 | 39 | 00111001 |
| Space | 32 | 20 | 00100000 |
| ! | 33 | 21 | 00100001 |
Converting binary to text by hand
First, split the binary into groups of 8 bits. Second, convert each group to a decimal number by adding the place values 128, 64, 32, 16, 8, 4, 2 and 1 wherever there is a 1. Third, look up the character for that number.
Example: 01001000 01101001
01001000 = 64 + 8 = 72, which is H
01101001 = 64 + 32 + 8 + 1 = 105, which is i
The text is Hi.
Converting text to binary
Going the other way, look up the number for each character and write it as 8 bits. The word Hello is made of the numbers 72, 101, 108, 108 and 111.
Example: Hello
H = 72 = 01001000
e = 101 = 01100101
l = 108 = 01101100 (twice)
o = 111 = 01101111
Hello = 01001000 01100101 01101100 01101100 01101111
ASCII, UTF-8 and other encodings
ASCII only covers 128 characters, so it cannot represent accented letters, other alphabets or emoji. UTF-8 solves this by using one to four bytes per character. The first 128 characters are identical to ASCII, which is why plain English text looks the same in both.
Characters outside ASCII take more bytes. The letter é is two bytes (11000011 10101001), the euro sign € is three bytes (11100010 10000010 10101100), and most emoji are four bytes.
This converter also supports UTF-16 in little-endian and big-endian byte order and Windows-1252. Several ISO-8859 encodings are available for decoding binary into text. Choose the encoding the data was created with. The wrong encoding is the most common reason for garbled or invalid output.
Other number systems
The same value can be written in different number systems. The number 72, the letter H in ASCII, is 1001000 in binary, 110 in octal and 48 in hexadecimal. Programmers often use hexadecimal because two hex digits describe exactly one byte, which is shorter and easier to read than eight binary digits.
Common problems and how to fix them
- An error about complete 8-bit bytes: binary written as one continuous run must be a whole number of bytes. A missing leading zero shifts every byte after it, so write each character as a full 8 bits.
- The output has strange symbols or an error about invalid data: try a different encoding, usually UTF-8.
- An invalid binary value: the input may contain a character other than 0 and 1. Separate groups with spaces, commas or semicolons, or enter one continuous run of full bytes.
- An error about ASCII in ASCII mode: ASCII stops at 127, so switch to UTF-8 or another encoding for characters beyond that.
Where binary to text conversion is useful
- Learning how computers store and represent data.
- Solving computer science homework and puzzles.
- Debugging data, network messages and file contents.
- Decoding messages that were written in binary.