Binary number system

Converting from Binary to Denary (Decimal)

What is Binary? Computers use a binary number system which means it only uses 2 'values' 0 or 1.

A computer is made up of millions of transistors, a transistor is like a light switch it is either on (1) or off (0). Denary numbers are the common numbers we use daily 0,1,2,3,4,5,6,7,8,9 also known as base 10, computers can only use two of these numbers 0,1 known as base 2.

The binary number table

128 64 32 16 8 4 2 1 - you should see a pattern going from right to left each number is doubled, this set of numbers is known as 8 bytes, each number represents 1 bit, if you need to convert larger numbers you just continue doubling the previous number 256, 512, 1024, etc.

Example 1

To convert a binary to denary (decimal) number every time a 1 appears in the binary number column we add the heading to our total - lets convert 11101110

The equivalent denary number is 128+64+32+8+4+2 = 238

Example 2

This time we will convert, 011110001011

I have expanded the binary table by doubling the previous number, this gives us

1024+512+128+8+2+1 = 1931

Also note: if we have a value in the first column '1' our denary number will always be an odd number!

Converting from denary to binary

There are two methods that you can use to convert from denary to binary, the first method uses successive subtraction 126,64,32 and so on.

Example 1

Method 1: Let's convert the denary number 142 to binary using our binary table, 142 is made up of 128+8+4+2 - 142 - 128 =14; 14 - 8 = 6; 6 - 4 = 2; 2 - 2 =0; subtract the largest power of 2 until the value 0 is reached.

For each number in our binary table, we can use place a 1 and fill the others with a 0, 142 = 10001110 as an 8-bit binary number.

Example 2

Method 2: Let's convert the same denary number 142 using the second method, where you divide the number by 2, write down the result including the remainder.

When you have finished dividing by 2, you read the binary number from bottom to top, this gives us the same number we had in method 1.

Please Note: Denary (Decimal) numbers go from left to right 0,1,2,3,4,5,6,7,8,9 Binary numbers go from right to left 1024,512,256,128,64,32,16,8,4,2,1