VITON13School
Free tools of the school

How to read binary: binary to decimal, hex and text, step by step

To convert binary to decimal, write the powers of two over the digits from right to left (1, 2, 4, 8, 16, 32, 64, 128) and add the values that sit over a 1. So 1101 is 8 + 4 + 1 = 13, and the byte 01000001 is 64 + 1 = 65, the code of the capital letter A.

By , Founder of VITON13 SCHOOL
Two rolls of punched paper tape, a narrow pale yellow one and a wider pink one, with rows of holes on a white background

Binary looks like an endless row of ones and zeros, but it is an ordinary place-value system with only two digits. This guide shows how to read a byte, how to convert binary to decimal and back with worked examples, why hexadecimal is binary in groups of four, and how a letter becomes eight bits. Every example can be checked in the free binary converter of VITON13 SCHOOL.

Key ideas

  • Binary is base 2: each place is worth twice the place to its right, so the eight places of a byte are worth 128, 64, 32, 16, 8, 4, 2 and 1.
  • Binary to decimal: add the place values under each 1. Decimal to binary: divide by 2 again and again and read the remainders from the last to the first.
  • One hexadecimal digit stands for four bits, so a byte is two hex digits from 00 to FF; one octal digit stands for three bits.
  • Text becomes binary through character codes: in ASCII and UTF-8 the letter A is 65, which is 01000001.

How do you read binary numbers?

Binary numbers are read like decimal ones, except that each place is worth twice the place to its right instead of ten times. A binary digit is called a bit and can only be 0 or 1. From the right, the places are worth 1, 2, 4, 8, 16, 32, 64 and 128, the powers of two from 2⁰ to 2⁷.

To read 1011, line it up with the place values 8, 4, 2, 1. There are ones under 8, 2 and 1, so the number is 8 + 2 + 1 = 11. A longer example: 10011100 sits under 128, 64, 32, 16, 8, 4, 2, 1, with ones under 128, 16, 8 and 4, so it is 128 + 16 + 8 + 4 = 156. Leading zeros change nothing: 00001011 is still 11.

Eight bits make a byte, so a byte can hold 2⁸ = 256 different values, from 00000000 (0) to 11111111 (255, the sum 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1). Four bits, half a byte, are called a nibble and run from 0 to 15. Each extra bit doubles the count: n bits give 2ⁿ values.

[1]

How do you convert binary to decimal and decimal to binary?

Binary to decimal has two methods. The first is the one above: add the place values under each 1. The second works from left to right without a table: start at 0, and for each bit double the running total and add the bit. For 1101 that gives 0 × 2 + 1 = 1, then 1 × 2 + 1 = 3, then 3 × 2 + 0 = 6, then 6 × 2 + 1 = 13.

Decimal to binary works by repeated division by 2. Divide the number by 2 and write down the remainder, 0 or 1; divide the quotient by 2 again, and stop when the quotient reaches 0. The remainders read from the last to the first are the binary number. For 13: 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1, so 13 is 1101.

A bigger example, 156: 156 ÷ 2 = 78 r 0, 78 ÷ 2 = 39 r 0, 39 ÷ 2 = 19 r 1, 19 ÷ 2 = 9 r 1, 9 ÷ 2 = 4 r 1, 4 ÷ 2 = 2 r 0, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Read upwards, the remainders give 10011100, the same byte that was read in the first section. The first remainder is always the rightmost bit, the one worth 1.

What are hexadecimal and octal, and how does text become binary?

Hexadecimal is base 16 and uses the digits 0 to 9 and then A, B, C, D, E and F for 10 to 15. Because 16 is 2⁴, one hex digit stands for exactly four bits, so binary turns into hex by splitting it into groups of four from the right: 1001 1100 is 9 and C, so 156 is 9C in hex, often written 0x9C. A byte is always two hex digits, from 00 to FF, and FF is 255. Octal, base 8, does the same with groups of three, because 8 is 2³: 010 011 100 is 2, 3, 4, so 156 is 234 in octal.

Text becomes binary through a table of character codes. In ASCII, and in UTF-8, which keeps the first 128 ASCII codes as single bytes, the capital A is 65, B is 66, the lowercase a is 97 and the space is 32. So A is stored as 01000001, a as 01100001, and the word Hi as two bytes, 01001000 01101001, which are 72 and 105.

Characters outside that first set take more bytes in UTF-8, from one to four in all. Most other Latin letters with accents and the Greek, Cyrillic, Hebrew and Arabic alphabets take two bytes, so é is 11000011 10101001 (C3 A9 in hex); most Chinese, Japanese and Korean characters take three, and emoji take four.

How to check binary to decimal conversions online

The free binary converter of VITON13 SCHOOL converts between binary, decimal, hexadecimal and octal and shows the steps. Type a number in any of the four and it appears in the other three, with the working written out, so you can compare it line by line with your own working on paper.

Then switch to text, which turns words into binary through UTF-8 and binary back into text: try A, then Hi, then a word with an accented letter, and see how many bytes each character takes. When you move on to negative numbers, the converter also shows two's complement, the usual way computers store negative whole numbers.

[2][3]

In everyday language

Binary is like a row of light switches where each switch is worth double the one to its right. To read the number, add up the switches that are on; to write a number, switch on the biggest values that still fit.

Try it yourself

Without a calculator, convert 01100001 to decimal, then check the result in the binary converter.

Expected result

The ones sit under 64, 32 and 1, so the answer is 97; the converter shows the same value with its steps, and as text the byte 01100001 is the lowercase letter a.

Check your answer: What is 25 in binary, using repeated division by 2?

11001. 25 ÷ 2 = 12 r 1, 12 ÷ 2 = 6 r 0, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1; read from the last remainder to the first, that is 1 1 0 0 1. Check: 16 + 8 + 1 = 25.

Questions

What is 11111111 in decimal?

255: the sum 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, the largest number one byte can hold, written FF in hexadecimal. The next number, 256, needs nine bits: 100000000.

How do you convert hexadecimal to binary?

Replace each hex digit with its four bits. 2F becomes 0010 1111, so 00101111, which is 32 + 8 + 4 + 2 + 1 = 47 in decimal.

Write the place values 128 down to 1 over any byte and add the ones; then open the VITON13 SCHOOL binary converter and check your answers, steps included, until you can read a byte at a glance.

Sources and further reading

  1. Wikipedia: Binary number (place values, conversion by repeated division by 2) ↗Sources checked:
  2. Wikipedia: Hexadecimal (base 16, one digit for every four bits) ↗Sources checked:
  3. Wikipedia: UTF-8 (one to four bytes per character, ASCII kept as single bytes) ↗Sources checked: