The Decimal, Binary, and Hexadecimal Numbring Systems

Basics of Numbering Systems

There are many different numbering systems, each one based on a number of symbols. Each symbol represents a unique value. You are familiar with the decimal system, using the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The decimal system is based on the powers of 10.  When we want to represent a value greater than 9, we use a compound system, where the right-most symbol is one power of ten higher that its neighbor on the left.

Thus, we have the number 397 is really:

3 times 100 (102)      300
9 times  10 (101)       90
7 times   1 (100)        7
                       ---
                       397
These are mathematical concepts we use daily, even if we do not think about them when we use those concepts.

The computer uses a different numbering system that is based on two symbols (which also is based on two states, on and off). The two symbols are 0 and 1. In this system, everything is based on a power of two.

This leads to 1011:

1 times  8 (23)         8 (decimal)
0 times  4 (22)         0 (decimal)
1 times  2 (21)         2 (decimal)
1 times  1 (20)         1 (decimal)
                      ---
                       11 (decimal)

Examination of this example should reveal that we used the same concepts, but substituted two for ten as the base. Since there are only two values in this system, it is called the binary numbering system.

When working with large binary values, humans have a tendency tory values, humans have a tendency to make mistakes, so we use a different numbering system which is more convenient to use, the hexadecimal numbering system. Hexadecimal means sixteen. So, what sixteen symbols are used for this? Simple, use the ten from the decimal system and add the first six letters of the alphabet: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

This leads to FE08:

F times  4096 (163) 61440 (decimal)
E times   256 (162)  3584 (decimal)
0 times    16 (161)     0 (decimal)
8 times     1 (160)     8 (decimal)
                    -----
                    65032 (decimal)
We can compare binary, decimal, and hexadecimal in the following table:

Binary Dec  Hex 
 0000     0    0
 0001     1    1
 0010     2    2
 0011     3    3
 0100     4    4
 0101     5    5
 0110     6    6
 0111     7    7
 1000     8    8
 1001     9    9
 1010    10    A
 1011    11    B
 1100    12    C
 1101    13    D
 1110    14    E
 1111    15    F
10000    16   10 

Conversions

Conversions are made easier if you learn some of the powers of two. You have to know or be able to reproduce the following chart:

Power Value
0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024
11 2048
12 4096
13 8192
14 16384
12 32768
12 65536

Binary to Decimal

To convert binary numbers to decimal, you can use addition, adding up the values of the powers of two, where the bit is a 1:

8   4   2   1
1   0   1   1
-   -   -   -
8 + 0 + 2 + 1 = 11

Decimal to Binary

Decimal binary can be done with subtraction, starting with subtracting the largest possible value of two:
 11
- 8     1
----
  3     0    Since the next value can not be subtracted, it is a zero
----
  3
- 2     1
----
  1    
- 1     1
----   --------
  0     1011      Once zero is reached, you are done.

Hexadecimal to Binary

Hex to binary and binary to hex are the simplest, since you only have to worry about sixteen possibilities! To convert FE08 to binary, look up each hex digit and put in the four bits that are the same value:
F    E    0    8
1111 1110 0000 1000

Binary to Hexadecimal

This is the reverse of Hex to Binary. To convert 1111111000001000, first divide the number into groups of four bits, starting from the left side:

1111 1110 0000 1000

Then convert each four bit group to hex:

1111 1110 0000 1000
F    E    0    8

What do you do if you have 11 1000? Easy, you can add a zero on the left side of any number and not change its value, so make it 0011 1000.