Hexadecimal to Decimal

Hexadecimal Number System

Base 16 number system which consists numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f}.

Decimal Number System

Base 10 number system which consists numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.


Hexadecimal Number System
Decimal Number System


Hexadecimal to Decimal Conversion Procedure

1. Write down the decimal equivalent of hexadecimal.

2. Find the position of every digit. We should count the position from the right direction of the number. And the position count starts from 0.

Example

1caf - position of f = 0, a = 1, c = 2, 1 = 3.

5afb - position of b = 0, f = 1, a = 2, 5 = 3.

3. Multiply every digit with 16 to the power of their corresponding position. (16 position)

4. Finally, calculate the sum of all the multiples.




Decimal equivalent of Hexadecimal

Decimal

Hexadecimal

0

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

A or a

11

B or b

12

C or c

13

D or d

14

E or e

15

F or f




Example

(16)16 to decimal

position = {1-1, 6-0}

= 1 x 16 1 + 6 x 16 0

= 16 + 6

= (22)10




Example

ffff to decimal

position = {f-3, f-2, f-1, f-0}

f equivalent decimal = 15

= 15 x 16 3 + 15 x 16 2 + 15 x 16 1+ 15 x 16 0

= 15 x 4096 + 15 x 256 + 15 x 16 + 15 x 1

= (65535)10




Example

16ab to decimal

position = {1-3, 6-2, a-1, b-0}

a equivalent decimal = 10

b equivalent decimal = 11

= 1 x 16 3 + 6 x 16 2 + a x 16 1+ b x 16 0

= 1 x 4096 + 6 x 256 + 10 x 16 + 11 x 1

= 4096+1536+160+11

= (5803)10




Example

ab0cffcd to decimal

position = {a-7, b-6, 0-5, c-4, f-3, f-2, c-1, d-0}

a equivalent decimal = 10

b equivalent decimal = 11

c equivalent decimal = 12

d equivalent decimal = 13

f equivalent decimal = 15

= a x 16 7 + b x 16 6 + 0 x 16 5+ c x 16 4 + f x 16 3 + f x 16 2 + c x 16 1+ d x 16 0

= 10 x 268435456 + 11 x 16777216 + 0 x 1048576 + 12 x 65536 + 15 x 4096 + 15 x 256 + 12 x 16 + 13 x 1

= 2684354560+184549376+0+786432+61440+3840+192+13

= (2869755853)10