Binary, Decimal and Hexadecimal Numbers


To understand Binary and Hexadecimal numbers, it is best to know how Decimal Numbers work.

Every digit in a decimal number has a "position", and the decimal point helps us to know which position is which.

The position just to the left of the point is the "Units" position. Every position further to the left is 10 times bigger, and every position further to the right is 10 times smaller:

decimal 17.591

Now, this is just a way of writing down a value. Other ways include Roman Numerals, Binary, Hexadecimal, and more. You could even just draw dots on a sheet of paper!

The Decimal Number System is also called "Base 10". Because it is based on the number 10.

And there are 10 symbols (0,1,2,3,4,5,6,7,8 and 9), but notice something interesting: there is no symbol for "ten". "10" is actually two symbols put together, a "1" and a "0":

In decimal you count "0,1,2,3,4,5,6,7,8,9,..." but then you run out of symbols!

So you add 1 on the left and then start again at 0: 10,11,12, ...

Counting with Different Number Systems

But you don't have to use 10 as a "Base". You could use 2 ("Binary"), 16 ("Hexadecimal"), or any number you want to!

Example: In binary you count "0,1,..." but then you run out of symbols!

So you add 1 on the left and then start again at 0: 10,11 ...

See how to count dots using Bases from 2 to 16 in this little demonstration:


Try this: select a Base, watch it count for a while, then press "||" (Pause). Now see if it has tallied the right number of dots, as in this example using base 2: number odometer
Example: 1×16 + 1×8 + 1×1 = 16+8+1 = 25

So the general rule is:

Count up until just before the "Base", then start at 0 again, but first you add 1 to the number on your left.

Binary Numbers

Binary Numbers are just "Base 2" instead of "Base 10". So you start counting at 0, then 1, then you run out of digits ... so you start back at 0 again, but increase the number on the left by 1.

Like this:

  there is no "2" in binary, so start back at 0 ...
... and add one to the number on the left
  start back at 0 again, and add one to the number on the left...
... but that number is already at 1 so it also goes back to 0 ...
... and 1 is added to the next number on the left

Hexadecimal Numbers

Hexadecimal numbers are interesting. There are 16 of them!

They look the same as the decimal numbers up to 9, but then there are the letters ("A',"B","C","D","E","F") in place of the decimal numbers 10 to 15.

So a single Hexadecimal digit can show 16 different values instead of the normal 10 like this:

Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F