First, we need to establish the distinction and importance of number bases.
Like units applied to values in varying forms of measurement (distance, length, quantity, volume, etc.), the number base being used to represent values carries some significance.
A number base, at its core, merely indicates how many unique symbols are present for denoting/counting numbers.
In everyday life today, base 10 seems to be the predominant number base used in general practice. But just because that is what we and our modern day civilization transact in, doesn't mean that decimal is the absolute best (indeed, there are various transactions it is notably less effective at), merely what is most commonly expressed (and assumed, if no other identification is provided with a given number).
Past civilizations utilized other number bases, remnants of that influence still survive to this day (the Sumerian use of bases 12 and 60, for example, especially in relation to time).
Computing aside, there are some real practical advantages to bases like 12 (or 60) over 10.
For one: 12 has more factors than 10, so it is far easier to carve out even divisions:
10 = { 1, 2, 5, 10 } 12 = { 1, 2, 3, 4, 6, 12 }
Think of some of the common divisions we seek to regularly apply to our numbers (in base 10): halves, thirds, quarters, eighths.
In base 10, that means:
In base 12, that means:
Even in the samples above, look at how cleaner thirds are for base 12 than base 10. Simply due to 12 having more factors than 10.
In computing-related endeavours, there is a strong relationship with the usage of base 2, which has but 2 counting values- 0 and 1.
This was done due to the nature of the switch, allowing for a distinctly OFF and ON state. It would have been impractical to use base 10 in this sense, because 8 of the numbers would effectively be useless, resulting in incoherent values.
Look at an example side to side, binary and decimal:
Sure, we can “memorize” that 255 is the equivalent of 11111111 in binary, but that also removes all the valuable information representing the data in binary offers us.
With but 2 total possibilities for the state (0, or 1), we can clearly see in 11111111 eight total switch states, something that “255” doesn't cleanly allow us to see.
So: because the computer is a binary device, it makes sense to use base 2 to transact numbers and information with it.
Why, then, are base 8 and 16 also frequently used with computer information?
That has to do with the mathematical concept of exponents (powers), of a base.
base 2, for instance: 2. What happens when we raise it to various exponents?
This is where we get our “powers of two” from. But moreso, notice how both 8 and 16 are both powers of 2?
This is where the application of octal (base 8) and hexadecimal (base 16) come in.
Because 8 is 2^3, and 16 is 2^4, it can be said that:
And the same in the reverse direction:
There is no rounding error, no remainder, no decimal places: a CLEAN whole value.
Take a look at this table of values:
base 2 | base 8 | base 10 | base 16 |
---|---|---|---|
0000 | 00 | 0 | 0x0 |
0001 | 01 | 1 | 0x1 |
0010 | 02 | 2 | 0x2 |
0011 | 03 | 3 | 0x3 |
0100 | 04 | 4 | 0x4 |
0101 | 05 | 5 | 0x5 |
0110 | 06 | 6 | 0x6 |
0111 | 07 | 7 | 0x7 |
1000 | 010 | 8 | 0x8 |
1001 | 011 | 9 | 0x9 |
1010 | 012 | 10 | 0xA |
1011 | 013 | 11 | 0xB |
1100 | 014 | 12 | 0xC |
1101 | 015 | 13 | 0xD |
1110 | 016 | 14 | 0xE |
1111 | 017 | 15 | 0xF |
So, if we had a binary value of 101101110010 (12 binary bits), we can directly and easily “convert” it from binary to octal or decimal (from the right and working left, group together the pertinent number of bits).
Likewise, in the opposite direction:
It is THAT EASY to transition between exponent bases of the baseline base. We can work this trick in base 4, base 32, base 64, etc.
It is NOT POSSIBLE to use this trick with bases that do NOT fall in a power of 2. 10, for instance.
There is no whole number for x where 2^x=10, so we have to resort to math. This is why decimal is NOT a good medium for expressing binary values.
Notice how LARGE the binary value gets compared to the higher base:
The higher the base, the SMALLER (in length) the resulting number will be.
We use base 8 and base 16 as a direct but convenient short-hand to allow us to express binary values, so we don't have to personally transact in each individual bit (yet can retain that necessary awareness of the bits). Again: NOT so convenient using decimal.