Human beings have ten fingers, and this is the most plausible explanation for why we use the decimal (base-10) system in our everyday lives. Computers, on the other hand, have two fingers states that they understand:
- Low and High in voltage range (example: transistor-transistor logic)
- North and South in magnetic polarity (example: hard disk drives)
- Light presence (example: fiber optics)
Let’s consider the first example. On the electronic level, a transistor either passes or blocks electric current. Consequently, in all digital systems, everything boils down to a low or high state, representing 0 and 1, respectively. (For example, the low range can be voltage between 0 and 0.8 volts, while the high range is between 2 and 3.3 volts, or 2.7 and 5 volts, depending on the electronic system.) We are not affected by how the 0 and the 1 are represented on the physical level; however, we are concerned with how to use these two digits to represent data, such as numbers.
In the previous task, we saw that we can use a set of bits to fine-tune the steps. For instance, 1 bit can represent 2 states, while 8 bits can represent 256 states. In this task, we will learn a bit more about the math behind it; however, don’t worry if it appears complex at first glance. Things will make more sense as you progress in your learning journey.
In simple math terms, a number such as 213 is actually the same as saying 200 + 10 + 3. Isn’t this right?
In a more technical representation, 213 can be written as 213 = 2 × 102 + 1 × 101 + 3 × 100. As you would remember from the math class, 102 = 100, 101 = 10, and 100 = 1.
Consequently, this was just the formal mathematical way of saying 213 = 2 × 100 + 1 × 10 + 3 × 1. If you have not worked with math for some time, please give this some thought and a second read before you move on.
Binary Numbers
The binary (base-2) system can be expressed similarly to what we wrote earlier, discussing the decimal (base-10) system. The key differences are that the binary system is limited to two digits, 0 and 1, and that everything is a power of 2. Let’s consider a couple of examples.
The binary number 1001 can be expressed as follows: 1001 = 1 × 23 + 0 × 22 + 0 × 21 + 1 × 20 = 1 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 8 + 0 + 0 + 1 = 9. We just demonstrated how to write 9 in binary.
Following the same approach, it won’t be challenging to convert the binary numbers 0000, 0001, 0010, 0011 to the decimal system. Let’s go through these four conversions.
0000 = 0 × 23 + 0 × 22 + 0 × 21 + 0 × 20 = 0 × 8 + 0 × 4 + 0 × 2 + 0 × 1 = 0
0001 = 0 × 23 + 0 × 22 + 0 × 21 + 1 × 20 = 0 × 8 + 0 × 4 + 0 × 2 + 1 × 1 = 1
0010 = 0 × 23 + 0 × 22 + 1 × 21 + 0 × 20 = 0 × 8 + 0 × 4 + 1 × 2 + 0 × 1 = 2
0011 = 0 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = 0 × 8 + 0 × 4 + 1 × 2 + 1 × 1 = 3
If this is your first time working with different bases, you might have already figured out that the rightmost digit is multiplied by 20 in the case of the binary (base-2) system and multiplied by 100 in the case of the decimal (base-10) system. Then, the next digit is multiplied by 21 in the base-2 system and by 101 in the base-10 system. And so forth till we reach the leftmost digit. It is easy, but requires careful attention not to miss any digit or misjudge its power.
As an exercise, we will convert four more binary numbers, 1100, 1101, 1110, and 1111, to the decimal system. Try to do this on a piece of paper before comparing your answers with the solutions below.
1100 = 1 × 23 + 1 × 22 + 0 × 21 + 0 × 20 = 1 × 8 + 1 × 4 + 0 × 2 + 0 × 1 = 8 + 4 + 0 + 0 = 12
1101 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 1 × 8 + 1 × 4 + 0 × 2 + 1 × 1 = 8 + 4 + 0 + 1 = 13
1110 = 1 × 23 + 1 × 22 + 1 × 21 + 0 × 20 = 1 × 8 + 1 × 4 + 1 × 2 + 0 × 1 = 8 + 4 + 2 + 0 = 14
1111 = 1 × 23 + 1 × 22 + 1 × 21 + 1 × 20 = 1 × 8 + 1 × 4 + 1 × 2 + 1 × 1 = 8 + 4 + 2 + 1 = 15
Having come this far, it is time to revisit the hexadecimal system.

Hexadecimal Numbers
In Task 2, we grouped every 4 bits into a single hexadecimal digit. As we’ve seen earlier, a hexadecimal digit ranges between 0 and F. By taking a closer look at the table below, you will notice that a hexadecimal digit ranges between 0 and 15 in the decimal system. To replace 10, 11, 12, 13, 14, and 15 each with a single letter/digit, A, B, C, D, E, and F are chosen. The table below is something you would encounter in any tutorial or chapter on the hexadecimal system.
Optional: Converting From Hexadecimal to Decimal System
This subsection is optional. If you are curious about converting a hexadecimal number to a decimal number, you would follow the same approach we used for binary conversion. Let’s say that we want to convert the hexadecimal number 9B DF to decimal.
9BDF = 9 × 163 + 11 × 162 + 13 × 161 + 15 × 160 = 9 × 4096 + 11 × 256 + 13 × 16 + 15 × 1 = 39,903
Optional: Octal Numbers
The octal system refers to base 8. In other words, it uses the digits between 0 and 7. While the hexadecimal system uses base 16 and groups 4 bits, the octal system uses base 8 and groups 3 bits. The table below shows how the octal digits relate to their binary counterparts.
Optional: Converting From Octal to Decimal System
Converting an octal number to its decimal equivalent follows the steps of the previous conversions. Consider the octal number 357.
357 = 3 × 82 + 5 × 81 + 7 × 80 = 3 × 64 + 5 × 8 + 7 × 1 = 239
Click on the View Site button below and use it to answer the following questions.