Task One: Part One | Introduction to Binary |
Before you are introduced to binary numbering, let's begin by taking you back to your early childhood when you learnt to count using decimal numbering.
You would have learnt that there are ten decimal values:
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
When you get to nine, you have exhausted the available values and you have to:
- Add a column to the left and set it to one.
- Return the unit column on the right to zero.
You then have the values:
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
By repeating this process with the ten's column you then have:
- 20, 30, 40. 50, 60, 70, 80, 90
When you reach 99 you then:
- Add another column to the left.
- Reset the units and tens back to zero.
- Then continue the process as before.
You then have the values:
- 100, 101, 102...
Introduction to binary
A binary numbering scheme only has two possible values, 1 or 0. You may have heard the term ‘on’ or ‘off’, which can be represented by:
- 1 = on
- 0 = off
The word binary comes from ‘Bi’ meaning two. Words like bicycle (two wheels) and binoculars (a pair of telescopes mounted side by side) are common examples.
Due to the nature of the way computers are designed and work, they can only deal with two values. You will have heard the term ‘bits’, for example, a 32-bit or 64-bit processor. The word ‘bit’ is short for Binary digit.
These two states of ‘on’ or ‘off’ are used in computer storage, processing and communications or networking. Programmers often call their executable files ‘binaries’ when they have a file extension of ‘.bin’.
Conversion of binary to decimal
Binary numbers can look odd when they are written in full, as they tend to be long numbers. This is due to the digit value increasing by the power of two, rather than by powers of ten:
- 1, 10, 100, 1000 etc.
With binary, we see the column increase by the power of two:
- 1, 2, 4, 8, 16, 32 etc.
Each column effectively doubles the previous value to the right.
The decimal equivalent of its binary value can be found by summing all the binary digits that are set to one as shown in the example below:
Decimal |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Binary |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
Therefore, the binary value of 1 0 1 0 1 0 1 is equal to the decimal value: 85
The calculation is 64+16+4+1 = 85
Note that 32, 8 and 2 are set to zero (off).
If 2 was set to one what would be the new decimal value?
IPv4 address
The most common address you will encounter as a network engineer is an IPv4 address.
This IPv4 address, with a total of 32 bits, is broken down into four equal-sized segments, then represented as decimal. This is known as ‘Dotted Decimal Notation’.
Example: 192.168.1.254
If the above value was written in binary it would look like this:
- 11000000101010000000000111111110
Imagine trying to tell a colleague this binary address during a telephone conversation. The likelihood of an error would be high.
You have learnt that Dotted Decimal Notation breaks the binary values down into eight-bit segments, converts them into decimal, each separated with a dot. So if you split the binary value into eight-bit segments you get:
Binary |
1100 0000 |
1010 1000 |
0000 0001 |
1111 1110 |
Then convert each segment to decimal:
Decimal |
192 |
168 |
1 |
254 |
Binary |
1100 0000 |
1010 1000 |
0000 0001 |
1111 1110 |
Example calculation for the first segment:
Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Binary |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
128 + 64 = 192
And so on for each segment until you get: 192.168.1.254.
Using this approach the maximum value of each of the four decimal values is 255.
This would be 1111 1111 in binary.
Think of where you have seen an IPv4 address that looks like this:
- 255.255.255.0
It's a class C subnet mask that has the most significant 24 bits set to 1:
- 11111111 11111111 11111111 00000000
As a Network Engineer, familiarity with binary to decimal conversion, and vice versa will help you immensely.
Answer to question
The new decimal value is 87.
Did you get it right?
When you're ready, please mark this task as complete by clicking the blue icon in the top right-hand corner.
A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.