___________________________________________________________________________________________________________________________

 

Hexadecimal (16)

In mathematics and computer science, hexadecimal, or simply hex, is a numeral system with a radix or base of 16 usually written using the symbols 0–9 and A–F or a–f. The current hexadecimal system was first introduced to the computing world in 1963 by IBM. An earlier version, using the digits 0–9 and u–z, was used by the Bendix G-15 computer, introduced in 1956.

For example, the decimal numeral 79 whose binary representation is 01001111 can be written as 4F in hexadecimal (4 = 0100, F = 1111).

It is a useful system in computers because there is an easy mapping from four bits to a single hex digit. A byte can be represented as two consecutive hexadecimal digits.

It was IBM that decided on the prefix of "hexa" rather than the proper Latin but more politically incorrect prefix of "sexa". The word "hexadecimal" is strange in that hexa is derived from the Greek έξι (hexi) for "six" and decimal is derived from the Latin for "ten". It may have been derived from the Latin root, but Greek deka is so similar to the Latin decem that some would not consider this nomenclature inconsistent. An older term was the pure Latin "sexidecimal", but that was changed because some people thought it too risqué, and it also had an alternative meaning of "base 60". However, the word "sexagesimal" (base-60) retains the prefix. The earlier Bendix documentation used the term "sexadecimal".

Some hexadecimal numbers are indistinguishable from a decimal number (to both humans and computers). Therefore, some convention is usually used to flag them.

In typeset text, the indication is often a subscripted suffix such as 5A316, 5A3SIXTEEN, or 5A3HEX.

 

 

Hex

Bin

Dec

0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

7

8

1000

8

9

1001

9

A

1010

10

B

1011

11

C

1100

12

D

1101

13

E

1110

14

F

1111

15

 

CONVERTING HEXADECIMAL TO DECIMAL

Steps:

  1. Get the last digit of the hex number, call this digit the currentDigit.  
  2. Make a variable, let's call it power.  Set the value to 0.
  3. Multiply the current digit with (16^power), store the result.
  4. Increment power by 1.
  5. Set the the currentDigit to the previous digit of the hex number.
  6. Repeat from step 3 until all digits have been multiplied.
  7. Sum the result of step 3 to get the answer number.

Example 1 
Convert the number 1128 HEXADECIMAL to DECIMAL

MULTIPLICATION

RESULT

NOTES

8 x (16^0)

8

Start from the last digit of the number.  In this case, the number is 1128.  The last digit of that number is 8.  Note that the power of 0 of any number is always 1 

2 x (16^1)

32

Process the previous, which is 2.  Multiply that number with an increasing power of 16.

1 x (16^2)

256

Process the previous digit, which is 1, note that 16^2 means 16 x 16

1 x (16^3)

4096

Process the previous digit, which is 1, note that 16^3 means 16 x 16 x 16

 

 

Here, we stop because there's no more digit to process

ANSWER

4392

This number comes from the sum of the RESULTS 
(8+32+256+4096)=4392

Once discerned, notice that the above process is essentially performing this calculation:

1x(16^3) + 1x(16^2) + 2x(16^1) + 8x(16^0) 

When doing this by hand, it is easier to start backward is because:

Example 2 
Convert the number 589 HEXADECIMAL to DECIMAL

MULTIPLICATION

RESULT

 9 x (16^0)

9

 8 x (16^1)

128

 5 x (16^2)

1280

 

 

ANSWER

1417

If you want to be a speed counter, it's beneficial to memorize the values of the smaller power of 16s, such as in this table

POWER OF 16s

RESULT

 16^0

1

 16^1 = 16

16

 16^2 = 16x16

256

 16^3 = 16x16x16

4096

 16^4 = 16x16x16x16

65536

Example 3
Convert the number 1531 HEXADECIMAL to DECIMAL
(This time, let's use the table of the power-of-16s above.)

MULTIPLICATION

RESULT

1 x 1

1

3 x 16

48

5 x 256

1280

1 x 4096

4096

 

 

ANSWER

5425

Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL

MULTIPLICATION

RESULT

8 x 1

8

A x 16 (remember that hex A=decimal 10)

160

F x 256 (remember that hex F=decimal 15)

3840

 

 

ANSWER

4008

Example 5
Convert the number 8F HEXADECIMAL to DECIMAL

DIVISION

RESULT

F x 1

15

8 x 16

128

 

 

ANSWER

143

Example 6
Convert the number A0 HEXADECIMAL to DECIMAL

DIVISION

RESULT

0 x 1

0

A x 16

160

 

 

ANSWER

160

Example 7
Convert the number 12 HEXADECIMAL to DECIMAL

DIVISION

RESULT

2 x 1

2

1 x 16

16

 

 

ANSWER

18

Example 8
Convert the number 35432 HEXADECIMAL to DECIMAL

2x(16^0) + 3x(16^1) + 4x(16^2) + 5x(16^3) + 3x(16^4) =
2 + 3x16 + 4*256 + 5*4096 + 3*65536 =
2 + 48 + 1024 + 20480 + 196608 = 
218162

 

 

CONVERTING HEXADECIMAL TO BINARY

 

 

 

CONVERTING HEXADECIMAL TO OCTAL