Binary to Denary

Remember when you were learning to add numbers in primary school you had to deal with units, tens, hundreds and thousands. Well working with Binary is no different.


Try this: 7+5 = 12, write down the 2 units but carry the group of 10.


In binary instead of working with the digits 0 to 9 we only have two digits, 1 and 0, so we carry the group of 2. In maths we call this base 2. Use the table below to see how we convert denary to binary.


 Denary  Binary  
 0 0  
 1  1  
 2  10  Notice that we now go to the second column  one group of 2 , no units
 3  11  One group of 2 plus one unit - 2+1=3
 4  100  Now we go to the third column, 2 groups of previous column, so this is 4
 5  101  
 6  110  
 7  111  
 8  1000  Every time we go to the next column it is two times the previous column
 9  1001  
 10  1010  

Can you see the pattern? The column headings in a binary number double each time:


 64 x 2  32 x 2  16 x 2 8 x 2  4 x 2   2 x 2  2 x 1  
 128  64  32  16  8  4  2  1
 2 x 2 x 2 x 2 x 2 x 2 x 2  2 x 2 x 2 x 2 x 2 x 2  2 x 2 x 2x 2 x 2  2 x 2 x 2 x 2  2 x 2 x 2  2 x 2  2  1
 27  26 25  24  23   22 21   10

Binary to Denary

To convert the binary number 111001 into a denary (decimal or base 10) number use the column headings. The number below is  32 + 16  + 8 + 1 = 57 

Add up the column headings where there is a 1.


 128 64  32  16 
 0

Denary to Binary

To convert a denary (decimal) number to binary the theory is similar.

You need to find the biggest column heading that you can take away from the number being converted and start there:

Let's convert 57 into binary:

1. The biggest column heading we can take out of 57 is 32 (the next is 64, which is too big)

2. Place a 1 in the column under the number 32 as this is largest number we can deduct from 57.

3. Next place a 1 in the column under 16 as this is the next largest number we can take away from 25. We got 25 by taking 32 from 57.

The table below might help you visualise what we have to do to complete the conversion.


 Number to convert    128  64  32  16  8  4  2  1
 57  128 is too big  0              
 57  64 still too big    0            
 57  57 - 32 = 25      1          
 25  25 - 16 = 9        1        
 9  9 - 8          1      
 1              0    
 1                0  
 1                  1
                   
 Binary Number    1  1  1  0  0  1
                   

Check the calculation, ignore the leading zero's:   32 + 16 + 8 + 0  + 0  + 1 = 57