How to convert decimal to binary

By AIM-VNR · Updated

To convert decimal to binary, divide the number by 2 again and again. Write down each remainder, then read the remainders from the last to the first.

Steps

  1. Divide the number by 2. Write the remainder (0 or 1).
  2. Divide the answer (the quotient) by 2 again. Write the remainder.
  3. Stop when the quotient is 0.
  4. Read the remainders from bottom to top.

Example 1: 45

Division Quotient Remainder
45 / 2 22 1
22 / 2 11 0
11 / 2 5 1
5 / 2 2 1
2 / 2 1 0
1 / 2 0 1

Reading the remainders from the bottom: 101101. So 45 is 101101 in binary.

Example 2: 13

13 / 2 = 6 r 1, 6 / 2 = 3 r 0, 3 / 2 = 1 r 1, 1 / 2 = 0 r 1. From the bottom: 1101.

Example 3: 100

100 / 2 = 50 r 0, 50 / 2 = 25 r 0, 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. From the bottom: 1100100.

Faster way

Subtract the biggest power of two that fits, put a 1 there, and repeat with the rest. For 100: 64 fits (1), 32 fits (1), 16 does not (0), 8 does not (0), 4 fits (1), 2 does not (0), 1 does not (0). That gives 1100100 too.

Practise it

In Binary Practice, open Training and choose decimal to binary.

Reverse direction: binary to decimal.