Binary and denary

How data needs to be converted into a binary format to be processed by a computer

Humans tend to use the number system. However, computers work in as binary represents current, whether or not current is flowing through the transistors that make up a processor. Denary numbers must be converted into their binary equivalent before a computer can use them.

The denary system has ten digits (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9). Each denary place value is calculated by multiplying the previous place value by ten. For example:

10,0001,000100101
10,000
1,000
100
10
1

So, the value of the number 124 in denary place values is actually:

Place value10,0001,000100101
Value00124
Place valueValue
10,0000
1,0000
1001
102
14

This gives (1 × 100) + (2 × 10) + (1 × 4) = 124

Converting binary to denary

Binary has just two units, 0 and 1. The value of each binary place value is calculated by multiplying the previous place value by two. The first eight binary place values are:

1286432168421
128
64
32
16
8
4
2
1

In binary, each place value can only be represented by 1 or a 0.

To convert binary to denary, simply take each place value that has a 1, and add them together.

Example - binary number 1111100

1286432168421
01111100
1280
641
321
161
81
41
20
10

Result: (0 × 128) + (1 × 64) + (1 × 32) + (1 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 124

Convert a denary number to binary - method 1

A method of converting a denary number to binary

Question

What would these binary numbers be in denary?

  • 1001
  • 10101
  • 11001100

Converting denary to binary

To convert from denary to binary, start by subtracting the biggest place value you can from the denary number, then place a 1 in that place value column. Next, subtract the second biggest place value you can, and place a 1 in the column. Repeat this process until you reach zero. Finally, place a 0 in any empty place value columns.

Example - denary number 84

First set up the columns of binary place values.

1286432168421
128
64
32
16
8
4
2
1

64 is the biggest place value that can be subtracted from 84. Place a 1 in the 64 place value column and subtract 64 from 84, which gives 20.

1286432168421
1
128
641
32
16
8
4
2
1

16 is the biggest place value that can be subtracted from 20. Place a 1 in the 16 place value column and subtract 16 from 20, which gives 4.

1286432168421
11
128
641
32
161
8
4
2
1

4 is the biggest place value that can be subtracted from 4. Place a 1 in the 4 place value column and subtract 4 from 4, which gives 0.

1286432168421
111
128
641
32
161
8
41
2
1

Place a 0 in each remaining empty place value column.

1286432168421
01010100
1280
641
320
161
80
41
20
10

Result: 84 in denary is 1010100 in binary.

To check that this is right, convert the binary back to denary:

(0 × 128) + (1 × 64) + (0 × 32) + (1 × 16) + (0 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 84

Another way to convert a denary number to binary is to divide the starting number by two. If it divides evenly, the binary digit is 0. If it does not and there is a remainder, the binary digit is 1. Finally, reverse the digits and you have the correct number.

Convert a denary number to binary - method 2

A method of converting a denary number to binary

Question

What would these denary numbers be in binary?

  • 12
  • 42
  • 188

The table below illustrates the relationship between denary and binary numbers, starting from 0 up to 255.

Table showing relationship between denary and binary numbers from zero to 255

Binary is also used within . To find out more, see the Boolean logic study guide.