Decimal to Hexadecimal Converter
This decimal to hexadecimal converter allows you to switch between numbers in their decimal and hexadecimal forms. Don't worry if you don't know what the hexadecimal system is – this article will provide you with all the information you need to perform these conversions correctly. If you ever wondered how to convert decimal to hexadecimal numbers, we will explain it to you and illustrate the conversion algorithm with easy-to-understand examples. Make sure to take a look at the binary to decimal converter and the binary to hexadecimal converter, too!
What is the hexadecimal system?
The hexadecimal system is a numeral system that uses sixteen different digits. Our ordinary decimal system uses just ten digits, from 0 to 9. The hexadecimal also uses letters A, B, C, D, E, and F. These letters represent values from ten (A) to fifteen (F).
Programmers often use the hexadecimal system because it allows for concise representation of binary numbers. For example, the number 1111 1111
in binary can be represented as simply FF
in hexadecimal. While the information is shown more compactly, binary operations like bit shifts and the bitwise operations AND, OR, and XOR can still be efficiently executed.
🙋 If you're not familiar with the bit operations mentioned above, visit our dedicated tools:
There are two main ways to represent hexadecimal numbers.
- The first one, most common in programming, is to use the prefix "0x". Then, the number FF will be written as 0xFF to inform the person reading the code that this number is hexadecimal.
- The second method is to use a subscript – for example, to write FF₁₆. Our decimal to hexadecimal converter does not include any of these notations, so keep that in mind when experimenting with how to convert decimal to hexadecimal numbers.
How to convert decimal to hexadecimal?
You can use an algorithm that is easy to remember to convert numbers from the decimal to hexadecimal system:
- Divide your initial decimal number by 16.
- Note down the remainder in the hexadecimal notation. This will be the last digit of the hexadecimal number (the rightmost one).
- Take the quotient. It is your new "initial number".
- Keep repeating the above steps, each time adding the remainder to the left of previously obtained digits.
For example, for number 4987
, we would have the following steps:
4987 / 16 = 311
, remainderB
311 / 16 = 19
, remainder7
19 / 16 = 1
, remainder3
1 / 16 = 0
, remainder1
Reading from the bottom to the top, 4987
corresponds to 137B
in the hexadecimal system. Check this result with our hex calculator!
How to convert hexadecimal to decimal?
To convert from hexadecimal to decimal, follow these steps:
- Take the leftmost digit of your initial number. Multiply it by 16.
- Add the next digit of the hexadecimal number. The sum will be your new "initial number".
- Keep repeating these steps, each time first multiplying by 16 and then adding the last digit.
For example, for the hexadecimal number 243A
, we would have the following steps:
2 × 16 = 32
(32 + 4) × 16 = 576
(576 + 3) × 16 = 9264
(9264 + 10) = 9274
243A
corresponds to 9274
in the decimal system. Check this result with the hexadecimal calculator!
How to use the decimal to hexadecimal converter?
You know what a decimal and hexadecimal number is and how to convert one to the other. So let's take a look at the decimal to hexadecimal calculator and its use.
Don't worry; it is effortless. Type the decimal number you want to convert to hexadecimal in the field Decimal. And that's all!
If we try this with our example decimal number 4987
from above, we receive the expected hexadecimal result: 137B
.
By default, the converter is limited to 16 bit. If you need to change that, enter the advanced mode, and you will be able to define a bit range of up to 20.
FAQ
How do I convert the number 123 to hexadecimal?
To convert the number 123
to hexadecimal, do the following:
- Divide by 16 and write down the remainder:
123 / 16 = 7
remainder11
. - Convert the remainder to the hexadecimal notation. This will be the last digit of the hexadecimal number:
B
- Divide the quotient by 16:
7 / 16 = 0
remainder7
. - Convert the remainder to the hexadecimal notation:
7
. - Since the remainder is 0, you are done. Your hexadecimal number is
7B
.
How do I convert the number 3A to decimal?
To convert the number 3A
to decimal, follow these steps:
- Take the leftmost digit of your initial number. Multiply it by 16:
3 × 16 = 48
. - Add the next digit of the hexadecimal number:
48 + 10 = 58
. - Your hexadecimal result is
58
.