Sales Toll Free No: 1-855-666-7446

Hexadecimal Numbers

Top

Hexadecimal system of numbers is widely used along with binary and octal numbers in computer science. Hexadecimals include the 10 digits 0 to 9, the letters A, B, C, D, E and F to represent the numbers from 10 to 15. In computer coding, two hexadecimal representation ranging from 00 to FF can efficiently replace a byte consisting of 8 binary bits. Hexadecimal coding is also considered to be relatively human friendly, when compared to long strings of binary coding.

Hexadecimal Numbers

Back to Top
Hexadecimal numbers are base 16 numbers whose digits are the remainders given by 16 division. The digits used in hexadecimal system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. The letters A, B, C, D, E and F are representative digits correspondingly for the numbers 10, 11, 12, 13, 14 and 15. The places values in hexadecimal system are powers of 16 and the fractions are separated by a dot with negative powers of 16 as place values.

The place value chart for Hexadecimal system of numbers is given below:

Hexadecimal Numbers
The place value of each position in hexadecimal system is 16 times the place value of the immediate position to its right.

Hexadecimal Representation

Back to Top
Let us look into how the decimal numbers are represented in Hexadecimal system. Each digit of the number is multiplied by its place value and the products are added to get the number in decimal system. For letters A, B, C, D, E and F, the corresponding numbers are used for multiplication.

Consider the Hexadecimal number 5F23A.
The correspondence between the digits and the face value are as follows:
5 F 2 3 A
164 163 162 161 160.
Thus, 5F23A = 5 x 164 + 15 x 163 + 2 x 162 + 3 x 161 + 10 x 1 = 327,680 + 61,440 + 512 + 48 + 10
5F23A16 = 389,69010.
The hexadecimal system provides more compact representation for larger numbers than the decimal system.

How to Convert Hexadecimal to Decimal?

Back to Top
The decimal form of a hexadecimal representation is the sum of the products of its digits and their corresponding place values. Let us look at the example.

Let us write B13F16 into its Decimal form.
Each digit is multiplied by its place value and the products are added to get the decimal equivalent of the number.
B13F16 = B x 163 + 1 x 162 + 3 x 161 + F x 160
= 11 x 4096 + 256 + 48 + 15
= 45,37510

How to Convert Decimal to Hexadecimal?

Back to Top
The method applied to convert a decimal to hexadecimal is similar to that which is followed to convert a binary number to a decimal. Divide the number and the successive quotients by 16. Arrange the remainders got in reverse order to get the hexadecimal number.

Let us find the hexadecimal equivalent for 187510.

How to Convert Decimal to Hexadecimal

The remainders in each step of division are 3, 5 and 3, reversing the order of which, we get the hexadecimal representation as 753.
187510 = 75316

Hexadecimal Arithmetic

Back to Top
While adding hexadecimal numbers, the sums exceeding 16 are carried over as 1.

Let us add A6B16 and 34C16
                                               
      1     <-- Carried over digit
    A 6 B
  + 3 4 C
---------
    D B 7
---------

As B and C correspond to 11 and 12, we essentially add 11 + 12 = 23 for adding B + C. 16 is subtracted from 23 and carried over as 1 to the next place and the difference 7 is written below.

Similar borrowing rules are applied in subtraction. 16 is borrowed from left, if the digit subtracted is greater.

Let us subtract 4A316 from 2B516
  16 16   <-- Borrowed numbers
34 9A 3
- 2 B 5
---------
  1 E E
---------

As 5 is greater than 3, to perform subtraction, 16 is borrowed from left. 16 + 3 - 5 = 14 which is written as E. After the borrow, digit 9 is left in the place of A. So, to subtract B, 16 is again borrowed from the the left. 16 + 9 - B = 25 - 11 = 14 which is again E. As 1 is used for borrow, 3 is left in the place of 4. 3 - 2 = 1.

Multiplication is carried out digit wise and the products are added as done with decimal numbers.

Let us multiply A216 and 1B16.

Hexadecimal Arithmetic

First, each digit in A2 is multiplied by B. 2 x B = 2 x 11 = 22, which is 16 in hexadecimal form. The digit 1 is carried over and added to the product A x B = 110 + 1 = 111, which is written as 6F. Addition rules are followed as explained earlier.

Hexadecimal Number Chart

Back to Top
The following chart gives Binary and hexadecimal representation for the decimal numbers 0 to 31.

Decimal
Binary Hexadecimal

Decimal
Binary
Hexadecimal
0
0000 00
16
10000 10
1
0001
01
17
10001
11
2
0010
02
18
10010
12
3
0011
03
19
10011
13
4 0100
04
20
10100
14
5
0101
05
21
10101
15
6
0110
06
22
10110
16
7
0111
07
23
10111
17
8
1000
08
24
11000
18
9
1001
09
25
11001
19
10
1010
A 26
11010
1A
11
1011
B
27
11011 1B
12
1100 C
28
11100
1C
13
1101
D
29
11101
1D
14
1110
E
30
11110 1E
15 1111
F
31
11111 1F