12th of March, 2026
The ‘deci’ prefix in decimal comes from the latin word ‘decimus’, which means ‘tenth’. Our counting system is base 10, meaning we count using powers of ten. Let’s take a look at the way we count in the decimal system. We can skip the first, boring, nine numbers. Only after those the decimal system becomes interesting, after having reached the first power of ten (\(10^1\)). We shift all numbers one space to the left and add a zero to the end. This repeats every time we reach a new power of ten: 10, 100, 1000, 10000, … (I’m not going to list them all, you get the gist).
Every shift to the left indicates a new power of ten. \(1 = 10^0\), \(10 = 10^1\), \(100 = 10^2\), \(1000 = 10^3\), etc. The position of the number, starting from the left indicates which power of ten it is. For instance in the number 1550 the first digit is \(1 * 10^3 = 1000\), the second digit is \(5 * 10^2 = 500\), the third digit is \(5 * 10^1 = 50\), and the fourth digit is \(0 * 10^0 = 0\). Adding these four values up (\(1000 + 500 + 50 + 0\)) results in the original value 1550.
While the decimal system is great for us, it is not useful for computers. Since computers work with electrical signals, which can be either on or off, a binary system works much better. The ‘bi’ in binary indicates a system with two possible values (instead of the ten in the ‘deci’ system). Those two values being 0 and 1. These values indicate the electrical states off and on. From now on let us refer to these 0 and 1 values as ‘bits’. A bit can be on, meaning it is 1, or off, meaning it is 0.
The binary system works the same way our decimal system works, with the only difference being that it is base 2, meaning it counts using powers of two instead of powers of ten. Let’s take the binary number 1101 as an example, which denotes the decimal number 13. Every shift to the left indicates a new power of two. Let’s deconstruct starting from the left. We get \(1 * 2^3 = 8\), \(1 * 2^2 = 4\), \(0 * 2^1 = 0\) and \(1 * 2^0 = 1\). Adding these four values up (\(8 + 4 + 0 + 1\)) we get the decimal number 13. Below is a table showing the first 8 numbers in binary form.
| Binary | Decimal |
|---|---|
| 000 | 0 |
| 001 | 1 |
| 010 | 2 |
| 011 | 3 |
| 0100 | 4 |
| 101 | 5 |
| 110 | 6 |
| 111 | 7 |
This table also clearly shows that using three bits we can represent decimal values in the range \(\{0, 7\}\), for a total of 8 distinct values. We can calculate this using by powering the base 2 by the number of bits as follows: \(2^{3} = 8\).
An interesting thing to point out is that without us even knowing the decimal representation of a binary number, we can determine whether it is an even or odd decimal number. Every single power of two is an even number, except the zero’th power of two, which is the number 1. If the rightmost bit in a binary number is on, the number will be odd. In all other cases the number will be even. Let’s look at some examples:
| Binary | Decimal | |
|---|---|---|
| 0001 | 1 | Odd |
| 1001 | 9 | Odd |
| 1111 | 15 | Odd |
| 1110 | 14 | Even |
| 1000 | 8 | Even |
| 0010 | 2 | Even |
Notice how all numbers that end with a bit that is turned on are odd!
A programming language will often give the programmer two choices when it comes to numbers. You can either have numbers which will always be positive, no negatives allowed, or have a slightly smaller range of numbers but allow for negative numbers as well. In this second case the first bit of a binary value will be used to denote whether a number is positive or negative! If the leftmost (first) bit is turned on, this indicates the value is negative! Below is an example of this in a scenario where we denote numbers using three bits:
| Binary | Decimal |
|---|---|
| 101 | -1 |
| 001 | 1 |
| 111 | -3 |
| 011 | 3 |
| 100 | -4 |
Also take note that in this scenario we can still represent 8 values, however the range has changed to \(\{-4, 3\}\). You might think the range would be \(\{-3, 3\}\), however, to prevent two binary values from representing 0 (100 as -0 and 000 as +0), the negative variant (100) instead reflects -4.
Similar to the way we can multiply and divide decimal numbers by ten we can multiply and divide binary numbers by two. Remember that by adding a zero at the end of a decimal number, we have effectively multiplied the number by ten. This can be seen as ‘shifting’ all digits of the number one value to the left, increasing their power of ten by one. Dividing by ten can be done by shifting all digits one value to the right. The rightmost digit then becomes the fractional part of the number. For instance, dividing 1015 by ten yields 101.5, dividing again yields 10.15. This can be done indefinitely. Multiplying works the other way around. Taking a number like 15 and shifting one to the left gives us 150, the result of multiplying 15 by ten.
This works almost the same way in the binary system. Multiplying by two can be done by shifting all bits to the left and adding a zero. The number 1101 (13) becomes 11010 (26). Dividing by two works by shifting all values to the right. The number 1101 (13) becomes 110 (6). Something interesting to note here is that dividing an uneven number will always result in an even number, as the rightmost value, dictating an even or odd number, will disappear. Once this has happened, there is no way to get back to the original number by multiplying, as for instance in this case this will result in the number 1100 (12).
Something else to note is that there are no fractions. Try representing the number 0.5 in binary! The way computers save and use fractional numbers is quite complex and different to what you might expect. It bears some resemblance to the way scientific notation works, storing the base value and the exponent as separate parts. This will be explained in a post down the line.