In this tutorial we will learn hexadecimal to decimal conversion of an integer number.

Before we dive into the main topic lets talk a little about Decimal and Hexadecimal Number System that we are going to work with in this tutorial.

A decimal number system consists of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. So, any number that we use in our daily life is actually in decimal number system.

In hexadecimal number system we use ten digits and six english alphabet letters.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F

10 is denoted as A

11 is denoted as B

12 is denoted as C

13 is denoted as D

14 is denoted as E

15 is denoted as F

Hexadecimal implies base 16

To convert a hexadecimal number into decimal form we have to multiply

ones place by 16^{0}

tens place by 16^{1}

hundreds place by 16^{2}

and so onâ€¦

The following table shows the places, hexadecimal number and the multipliers for the corresponding places.

place | tens | ones |

hexadecimal | A | 1 |

multiplier | 16^{1} | 16^{0} |

`= Ax16`^{1} + 1x16^{0}
= 10x16^{1} + 1x16^{0}
= 160 + 1
= 161

So, the required decimal number is

A1_{(base 16)} = 161_{(base 10)}

Alternatively, (A1)_{16} = (161)_{10}

Where, (base 10) means the number is in decimal number system and (base 16) means the number is in hexadecimal number system.

The following table shows the places, hexadecimal number and the multipliers for the corresponding places.

place | thousands | hundreds | tens | ones |

hexadecimal | 5 | 0 | A | F |

multiplier | 16^{3} | 16^{2} | 16^{1} | 16^{0} |

`= 5x16`^{3} + 0x16^{2} + Ax16^{1} + Fx16^{0}
= 5x16^{3} + 0x16^{2} + 10x16 + 15x16^{0}
= 20480 + 0 + 160 + 15
= 20655

So, the required decimal number is

50AF_{(base 16)} = 20655_{(base 10)}

Alternatively, (50AF)_{16} = (20655)_{10}

Where, (base 10) means the number is in decimal number system and (base 16) means the number is in hexadecimal number system.

- How to backup and restore MySQL or MariaDB database using mysqldump Reference Database
- HTML Getting Started HTML
- ChartJS | How to create Doughnut Chart using data from MySQL (MariaDB) table and PHP ChartJS
- MongoDB - Delete Documents MongoDB
- MongoDB - Update Documents MongoDB
- MongoDB - Query for Null and Missing fields MongoDB
- MongoDB - Query an Array of Embedded Documents MongoDB
- MongoDB - Query an Array MongoDB
- MongoDB - Query Embedded Document MongoDB
- MongoDB - Query Document MongoDB