Decimal to Hex Converter Online Tool
About Decimal to Hex Converter Online Tool:
This online decimal to hex converter tool helps you to convert one input decimal number (base 10) into a hex number (base 16).
Decimal Numeral System:
Decimal numeral system (also called Hindu-Arabic, or Arabic) has 10 digits, include (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
, it's the most used number system in our daily life. Decimal numeral system is also
one of the most ancient number system, it's inspired by 10 fingers of human.
Hex Numeral System:
Hex numeral system (also called hexadecimal) has 16 digits, include (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
just like decimal numeral system, plus (a, b, e, d, e, f)
6 additional characters. Which
means it's is a number system of base 16. Since Hex numeral system can represent any binary string in a readable way, It is widely used in computer science. The SHA256 hash string is often appears as Hex style
string, the Color System used in HTML is also be written down as Hex number, from #000000
(pure black) to #FFFFFF
(pure white).
How to convert from decimal to hex?
Step 1: Divide the decimal number by 16, get the integer quotient and the remainder.
Step 2: Convert the remainder to the hex digit in that position.
Step 3: Using the integer quotient to repeat the steps until the integer quotient equals to 0.
Example: Convert decimal number "2024" to hex number (result is "7E8"):
Repeat Division | Integer Quotient | Remainder (decimal) | Remainder (hex) | Digit Position |
---|---|---|---|---|
2024/16 | 126 | 8 | 8 | 0 |
126/16 | 7 | 14 | E | 1 |
7/16 | 0 | 7 | 7 | 2 |
Decimal to Hex conversion table:
Decimal | Hex | Decimal | Hex |
---|---|---|---|
1 | 1 | 30 | 1E |
2 | 2 | 40 | 28 |
3 | 3 | 50 | 32 |
4 | 4 | 60 | 3C |
5 | 5 | 70 | 46 |
6 | 6 | 80 | 50 |
7 | 7 | 90 | 5A |
8 | 8 | 100 | 64 |
9 | 9 | 200 | C8 |
10 | A | 300 | 12C |
11 | B | 400 | 190 |
12 | C | 500 | 1F4 |
13 | D | 600 | 258 |
14 | E | 700 | 2BC |
15 | F | 800 | 320 |
16 | 10 | 900 | 384 |
17 | 11 | 1000 | 3E8 |
18 | 12 | 2000 | 7D0 |
19 | 13 | 3000 | BB8 |
20 | 14 | 4000 | FA0 |
More information:
Wikipedia (Hexadecimal): https://en.wikipedia.org/wiki/Hexadecimal
Wikipedia (Decimal): https://en.wikipedia.org/wiki/Decimal
Convert Decimal to Hex with Python:
def decimal_to_hex(decimal_str): decimal_number = int(decimal_str, 10) hex_number = hex(decimal_number) return hex_number decimal_input = '2024' hex_output = decimal_to_hex(decimal_input) print('hex result is:{0}'.format(hex_output)) ------------------- hex result is:0x7e8
Convert Decimal to Hex with Java:
public class NumberConvertManager { public static String decimal_to_hex(String decimal_str) { return Integer.toHexString(Integer.parseInt(decimal_str)); } public static void main(String[] args) { String decimal_input = "2024"; String hex_output = decimal_to_hex(decimal_input); System.out.println("hex result is:" + hex_output); } } ------------------- hex result is:7e8