Chapter 2

Converting Between Binary and Decimal

Binary is base 2 (only 0 and 1). Add place values to read binary, and divide by 2 to write decimal as binary.

Binary and decimal

The decimal system is base 10 and uses ten digits (0 to 9). The binary system is base 2 and uses only two digits, 0 and 1. Computers store data in binary because a circuit is easily set to "off" (0) or "on" (1).

In binary, each position has a place value that doubles from right to left: 1, 2, 4, 8, 16, and so on. To find the decimal value, add the place values wherever there is a 1. Being confident with both systems helps you understand how the numbers you type are actually stored inside a computer.

Example

Convert 10112 to decimal:
(1×8) + (0×4) + (1×2) + (1×1) = 8 + 0 + 2 + 1 = 11.

Decimal to binary

To change a decimal number to binary, repeatedly divide by 2 and write the remainders from bottom to top. You can also subtract the largest place values that fit.

Example

Convert 13 to binary using place values 8, 4, 2, 1:
13 = 8 + 4 + 1, so the bits are 1101.
Answer: 13 = 11012.

Handy data units

A single binary digit is a bit. Four bits make a nibble, and eight bits make one byte. A 4-bit number can store values from 00002 (0) up to 11112 (15).

Remember

  • Binary is base 2; the digits are only 0 and 1.
  • Place values double: 1, 2, 4, 8, 16 …
  • 10112 = 11 and 13 = 11012.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor