Do you need to convert a hexadecimal number into a form that is more understandable to you or your computer? Converting a hexadecimal number to binary is a very simple process, which is why the base 16 numbering system has been adopted by some programming languages. Conversely, converting a hexadecimal number to a decimal takes a little more effort, however once you master the concept it will be easy to apply in any case.
Steps
Part 1 of 3: Converting a Hex Number to Binary
Step 1. Convert all base numbers of the hexadecimal system to their respective 4-digit binary number
First of all, the hexadecimal numbering system was adopted because its conversion into binary, and vice versa, is a very simple process. Basically, hexadecimal numbers are used to represent a binary number with a much shorter character string. The following table is all you need to be able to convert a hexadecimal number to binary or vice versa:
Hexadecimal | Tracks |
---|---|
0 | 0000 |
1 | 0001 |
2 | 0010 |
3 | 0011 |
4 | 0100 |
5 | 0101 |
6 | 0110 |
7 | 0111 |
8 | 1000 |
9 | 1001 |
TO | 1010 |
B. | 1011 |
C. | 1100 |
D. | 1101 |
AND | 1110 |
F. | 1111 |
Step 2. Try it yourself
It is really a very simple process, it is enough to replace every single hexadecimal digit with the respective 4 binary symbols. Below are some hex numbers that you can try to convert to binary. At the end, select with the mouse the invisible text placed to the right of the = symbol to verify the correctness of your work:
- A23 = 1010 0010 0011
- BEE = 1011 1110 1110
- 70C558 = 0111 0000 1100 0101 0101 1000
Step 3. Understand the process behind the conversion
In the "base 2" binary system, n binary digits can be used to represent a set of numbers equal to 2 n. For example, having a binary number consisting of four digits available, it is possible to represent 24 = 16 different numbers. The hexadecimal system is a "base 16" number system, so a single digit can represent 161 = 16 different numbers. This relationship makes the conversion of numbers between the two systems extremely simple.
-
Both systems, hexadecimal and binary, are positional numbering systems and the transition to the higher counting unit occurs cyclically at exactly the same time. For example, in hex we have … D, E, F,
Step 10. "and at the same time in binary we will have" 1101, 1110, 1111, 10000 ".
Part 2 of 3: Convert a Hex Number to Decimal
Step 1. Let's examine how base 10 works
Remember that every day you use the decimal numbering system without having to stop and think about how it works or what it means, but the first time you were taught, by your parents or a teacher, it was described in every detail. Quickly reviewing the process by which decimal numbers are represented can help you convert from hex to decimal:
- Each digit that makes up a decimal number takes on a specific "position" that determines its value. Starting from the right and moving to the left, each digit of a decimal number describes respectively the "units", the "tens", the "hundreds" and so on. The number 3 expresses a quantity equal to 3 units, but within the number 30 it describes a quantity equal to 3 tens of units, while within the number 300 it describes a quantity equal to 3 hundreds of units.
- To mathematically express this concept, we use the powers in base 10, where the "position" occupied by each digit indicates the exponent of the power. So we will have 100, 101, 102, and so on. This is why this numbering system is called "base ten" or "decimal".
Step 2. Write a decimal number in the form of an addition
This step may seem obvious to you, but it's the same process used to convert a decimal number to hex, so it's a great place to start. Let's start by rewriting the number 480.137 in this form10 (remember that the subscript 10 indicates that it is a "base ten" number):
- Let's start with the first digit on the right: 7 = 7 x 100 or 7 x 1.
- Moving to the left to the next digit we will have: 3 = 3 x 101 or 3 x 10.
- Repeating this process for all the digits that make up our example number we will get: 480.137 = 4 x 100.000 + 8 x 10.000 + 0 x 1.000 + 1 x 100 + 3 x 10 + 7 x 1.
Step 3. We perform the same procedure with a hexadecimal number
Since the hexadecimal system is "base sixteen", each digit of a number corresponds to a power of 16. To convert a hexadecimal number to a decimal, multiply each digit that composes it by the power of sixteen relative to its position. Start by expressing each digit of the hexadecimal number by the power of 16 relative to its position. Let's say we want to convert the number C921 to decimal16. The least significant digit is the power 160 and every time we move to the left by one digit we also increase the exponent of the power by one unit. By adopting this procedure we will obtain:
- 116 = 1 x 160 = 1 x 1 (all numbers are decimal numbers except where otherwise indicated).
- 216 = 2 x 161 = 2 x 16.
- 916 = 9 x 162 = 9 x 256.
- C = C x 163 = C x 4096.
Step 4. Convert the base letters of the hexadecimal numbering to the corresponding decimal number
The numerical values of the hexadecimal and decimal system are identical, so there is no need to convert them (for example the number 716 is equal to 710). On the contrary, the alphabetic characters will be converted into their respective decimal numbers as follows:
- A = 10
- B = 11
- C = 12 (in order to carry out the calculations of our example we will have to use this equivalence)
- D = 13
- E = 14
- F = 15
Step 5. Perform the calculations
Now that all the digits of our hexadecimal number have been written in their decimal form, we just have to do the calculations to arrive at the final answer. When converting hexadecimal numbers to decimal numbers it is always very useful to use a calculator. Let's continue converting our example number C921 by performing the required calculations:
- C92116 = (in decimal) (1 x 1) + (2 x 16) + (9 x 256) + (12 x 4096)
- = 1 + 32 + 2.304 + 49.152.
- C92116 = 51.48910. Normally, the decimal number corresponding to a hexadecimal number consists of many more digits. This is because the digits of a hexadecimal number can represent more information than a decimal number.
Step 6. Practice
Below is a list of hexadecimal numbers to convert to decimal numbers. Once you have identified your answer, select with the mouse the invisible text placed to the right of the = symbol to verify the correctness of your work:
- 3AB16 = 93910
- A1A116 = 41.37710
- 500016 = 20.48010
- 500D16 = 20.49310
- 18A2F16 = 100.91110
Part 3 of 3: Understanding the Basics of the Hexadecimal System
Step 1. Understand when to use a hexadecimal number
The standard numbering system is the decimal in base 10, where 10 basic symbols are used with which all the other numbers are then represented. The hexadecimal system is instead based on 16, which means that it is composed of 16 unique symbols with which all the other numbers can then be represented.
-
We count in hexadecimal and decimal starting from 0:
Hexadecimal Decimal Hexadecimal Decimal 0 0 10 16 1 1 11 17 2 2 12 18 3 3 13 19 4 4 14 20 5 5 15 21 6 6 16 22 7 7 17 23 8 8 18 24 9 9 19 25 TO 10 1A 26 B. 11 1B 27 C. 12 1C 28 D. 13 1D 29 AND 14 1E 30 F. 15 1F 31
Step 2. Use the subscript to indicate which numbering system you are using
On occasions when the numbering system adopted is unclear, use a decimal number as a subscript to indicate the base of the numbering system used. For example, expression 1710 it means "17 to base ten" (it therefore refers to a classic decimal number). 1710 = 1116 or "11 in base sixteen" (ie in hexadecimal). If the number you are representing is made up of numbers and characters, you can also omit the subscript. For example, 11B or 11E: no one will be able to confuse these numbers as decimal numbers.
Advice
- Converting very long hexadecimal numbers to decimal may require the use of one of the many converters available online. The use of these tools also avoids the manual execution of the large amount of calculations required by the conversion process. However, practice is the best way to fully understand how this process works.
- You can adapt the procedure for converting a hexadecimal number to a decimal to be able to convert any base x number to a decimal number. You simply need to replace the powers with base sixteen with the powers with base x. Try learning the Babylonian sexagesimal numbering system.