Decimal and hexadecimal (hex) are two different numeral systems used to represent numbers.
Decimal is the base-10 numeral system, which is the one most commonly used by humans. It uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. In the decimal system, each digit’s position represents a power of 10.
Hexadecimal is a base-16 numeral system often used in computing and digital systems. It uses sixteen symbols: 0-9 for values 0 to 9, and A-F (or a-f) for values 10 to 15. In hex, each digit’s position represents a power of 16.
Converting a decimal number to hexadecimal involves dividing the decimal number by 16 and noting the remainders at each step. Here’s a step-by-step process:
Decimal base 10 Ready to Test Your Skills? Check Your Performance Today with our Free Mock Tests used by Toppers! Take Free Test | Hex base 16 |
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
7 | 7 |
8 | 8 |
9 | 9 |
10 | A |
11 | B |
12 | C |
13 | D |
14 | E |
15 | F |
16 | 10 |
17 | 11 |
18 | 12 |
19 | 13 |
20 | 14 |
21 | 15 |
22 | 16 |
23 | 17 |
24 | 18 |
25 | 19 |
26 | 1A |
27 | 1B |
28 | 1C |
29 | 1D |
30 | 1E |
40 | 28 |
50 | 32 |
60 | 3C |
70 | 46 |
80 | 50 |
90 | 5A |
100 | 64 |
200 | C8 |
1000 | 3E8 |
2000 | 7D0 |
Decimal and hexadecimal are different numeral systems with varying bases. Decimal uses base-10 (0 to 9), while hexadecimal uses base-16 (0 to 9 and A to F).
To convert decimal to hex, follow these steps: Divide the decimal number by 16. Write down the remainder as a hexadecimal digit (0 to 9 or A to F). Continue dividing and writing down remainders until the quotient becomes 0. Read the hexadecimal digits in reverse order to obtain the hex representation.
Hexadecimal 9 is equivalent to the decimal number 9.
To convert a decimal number to hexadecimal, follow the steps mentioned earlier for conversion.
Hexadecimal 12 is equivalent to the decimal number 18.
In programming and computing, 0x is a prefix used to indicate that a number is in hexadecimal notation. For example, 0x1A represents the hexadecimal number 1A, which is equivalent to 26 in decimal.