.
Hex (hexidecimal) Explained

By John T Burt, Feb 25,
1997
"What Is Hex?"
Hex stands for hexadecimal. At
its simplest, hex numbers are base 16 (decimal is base 10). Instead to counting
from 0 to 9, as we do in decimal, and then adding a column to make 10, counting
goes from 0 to F before adding a column. The characters A through F represent
the decimal values of 10 through 15 as illustrated below.
decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
Counting proceeds like this. 0 1
2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18
19 1A 1B 1C 1D 1E 1F 20 21 and up as far as one wants to go, just like
any other number.
Another way to explain hex is, each
column in a hex number represents a power of 16. (In decimal each column
represents a power of 10.)
There's
more about this below.
"Why Use Hex?"
Hex is used because it is the
easiest way to represent the value of a standard 8 bit binary computer byte,
and there are a lot of those around that need to be represented.
"What Is Binary?"
Binary numbers are base 2. In
binary counting only goes from 0 to 1 before adding a column. It's illustrated
below. As you will see, it takes a lot of space to represent a small value in
binary.
decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
Another way to put it is each column
in a binary number represents a power of 2.
There's
more about this below.
"How Is Hex Used?"
Four binary bits can be
represented as a single hex digit as follows.
Binary
|
1111
|
1110
|
1101
|
1100
|
1011
|
1010
|
1001
|
1000
|
0111
|
0110
|
0101
|
0100
|
0011
|
0010
|
0001
|
0000
|
Decimal
|
15
|
14
|
13
|
12
|
11
|
10
|
9
|
8
|
7
|
6
|
5
|
4
|
3
|
2
|
1
|
0
|
Hex
|
F
|
E
|
D
|
C
|
B
|
A
|
9
|
8
|
7
|
6
|
5
|
4
|
3
|
2
|
1
|
0
|
Thus the eight binary bits of a
standard byte can be represented as two simple hex digits as illustrated in the
drawing below. There's no way to do this as "elegantly" in decimal.

Binary, Decimal and Hex as Powers.
Binary Numbers
|
col
7
|
col
6
|
col
5
|
col
4
|
col
3
|
col
2
|
col
1
|
col
0
|
base
power
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
Decimal
equivalent of a 1 in this column
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Decimal Numbers
|
column
3
|
column
2
|
column
1
|
column
0
|
base
power
|
103
|
102
|
101
|
100
|
Decimal
value of a 1 in this column
|
1000
|
100
|
10
|
1
|
Maximum
value of this column
|
9000
|
900
|
90
|
9
|
Hexadecimal Numbers
|
column
1
|
column
0
|
base
power
|
161
|
160
|
Decimal
equivalent of a 1 in this column
|
hex
10 = dec 16
|
hex
1 = dec 1
|
Maximum
value of this column
|
hex
F0 = dec 240
|
hex
F = dec 15
|
Related subject - Hex Addition