Binary

Binary maths – what you need to know in order to subnet

 

Here is a Secret


Technically you can get away with not knowing binary mathematics if you want to just be able to subnet your network.  So long as you understand that all IP addresses are in binary and that each octet can only go from 0 to 255 then you should be fine.  If you have any IT exams coming up, especially Cisco or Microsoft then you may well be asked to work out binary numbers and convert them to decimal or even hex!

 

How Binary Works


We use the decimal counting system as humans because we have ten digits on our hands so that is how mankind learned to count.  Computers only have electrical currents so they can only see a current or no current.  No current is 0 and current is 1.  The only numbering system that can cater for this is binary.

 

Binary numbering starts with a 1 and then doubles in columns.  You can count from 0 to infinity and beyond with this numbering system.  Just keep adding columns (from right to left).  A 0 means don’t use that number and a 1 means do use that number.

 

Numbers 2 1
Binary 1 0

 

Here you have a 1 or ‘on’ number in the 2 column and a 0 or ‘off’ in the 1 column so your number is 2.

 

Numbers 4 2 1
Binary 1 0 1

 

This time we have a 1 in the 1 and the 4 columns so we simply add that together to get 5 as the answer.

 

Numbers 8 4 2 1
Binary 1 1 0 1

 

And this time we have a 1 in the 8,4 and 1 columns so adding them together we have 13.

 

We could keep going here but we should stop at 8 columns because current IP addresses use eight binary places or an octet.  In fact an IP version 4 address uses 4 octets.

 

Numbers 128 64 32 16 8 4 2 1
Binary 1 0 0 1 1 1 0 1

 

In the above example we add 128+16+8+4+1 to get 157.

An IP address in binary would look like this to a computer or router:

 

 

11010010.11101101.11000010.11110110 which is four octets.

 

Convert Binary to Decimal


This is a very simple process.  Just write out the binary number putting it into the above chart.  Add the numbers together and you have your answer.

 

Convert Decimal to Binary


A little more tricky.  Write out the above chart again and put a 1 in the numbers which add up to your required binary number.  So if you wanted to work out 203 in binary you would tick the 128 and 64 columns (192), ticking the 32 column would give it too much, tick the 8 column (200) and then the 2 and 1 columns.  If you prefer you can start from the other end adding 1 to 2 to 4 and so on but it does work better from the left to right.

 

Your answer would look like this:

 

Numbers 128 64 32 16 8 4 2 1
Binary 1 1 0 0 1 0 1 1

 

There are loads more examples in Subnetting Secrets along with binary to decimal and hex to decimal test questions.