Hex Calculator
0
Decimal value:
0
Decimal = (hn × 16n) + ... + (h0 × 160)
Example: Convert 2F to Decimal
2F = (2 × 16) + (F × 1) = 32 + 15 = 47
1. Divide the number by 16
2. Record the remainder (0–9, A–F)
3. Repeat with quotient until 0
4. Hex = remainders in reverse order
Example: Convert 47 to Hex
47 ÷ 16 = 2 R15 (F)
2 ÷ 16 = 0 R2
Hex = 2F
1. Convert hex to decimal
2. Perform operation
3. Convert result to hex
Example: 2F + 1A
2F = 47, 1A = 26 → 47 + 26 = 73 → Hex = 49
What is the Hexadecimal Number System?
The hexadecimal (hex) number system is a base-16 system, unlike the decimal (base-10) or binary (base-2) systems. Hex uses 16 unique symbols: numbers 0–9 and letters A–F, where A through F represent decimal values 10 through 15.
Each hex digit corresponds to 4 binary digits (bits), making it easier to convert and compress binary data. For instance, the binary number 1010101010
is equal to 2AA
in hex, providing a simpler representation for computers and programmers.
Hex to Decimal and Binary Conversion Table
Here’s a quick reference table for converting between hex, binary, and decimal values:
Hex | Binary | Decimal |
---|---|---|
0 | 0 | 0 |
1 | 1 | 1 |
2 | 10 | 2 |
3 | 11 | 3 |
4 | 100 | 4 |
5 | 101 | 5 |
6 | 110 | 6 |
7 | 111 | 7 |
8 | 1000 | 8 |
9 | 1001 | 9 |
A | 1010 | 10 |
B | 1011 | 11 |
C | 1100 | 12 |
D | 1101 | 13 |
E | 1110 | 14 |
F | 1111 | 15 |
14 | 10100 | 20 |
3F | 111111 | 63 |
How to Convert Hex to Decimal
To convert a hexadecimal number to decimal, multiply each hex digit by 16 raised to its position power, starting from the right (position 0). Remember: A = 10, B = 11, and so on.
Example: Convert 2AA to decimal
= (2 × 256) + (10 × 16) + (10 × 1)
= 512 + 160 + 10 = 682
How to Convert Decimal to Hex
To convert from decimal to hex:
Find the largest power of 16 less than or equal to your number.
Determine how many times it fits into your number.
Multiply and subtract to find the remainder.
Repeat for the next smaller power of 16.
Replace values above 9 with corresponding hex letters (A–F).
Example: Convert 1500 to hex
1500 ÷ 256 (16²) = 5 → remainder: 220
220 ÷ 16 (16¹) = 13 → remainder: 12
Hex digits: 5 (16²), D (13), C (12)
Answer: 1500 = 5DC (hex)
Hex to Decimal Conversion (Another Example)
Example: Convert 1024 (hex) to decimal
= (1 × 16³) + (0 × 16²) + (2 × 16¹) + (4 × 16⁰)
= 4096 + 0 + 32 + 4 = 4132
Hex Addition Explained
Adding hex numbers follows the same principle as decimal addition, but includes A–F digits. You can convert to decimal, perform the addition, and convert back to hex if needed.
Example:
18 1A B
+ B 7 8
———————–
1 4 2 3
Explanation:
B (11) + 8 = 19 → 1 carry, 3
1 (carry) + A (10) + 7 = 18 → 1 carry, 2
1 (carry) + 8 + B (11) = 20 → 1 carry, 4
Final result: 1423 (hex)Hex Subtraction Explained
Hex subtraction is also similar to decimal subtraction, with one key difference: borrowing involves 16 instead of 10. When subtracting and a smaller number is above a larger one, you borrow 16 from the next digit.
Example:
5 D 1C
– 3 A F
——————-
2 2 DC (12) – F (15): Borrow from D → becomes C (12), gives 16 + 12 – 15 = 13 → D
C (now) – A = 12 – 10 = 2
5 – 3 = 2
Answer: 22D
If subtracting a larger number from a smaller one, simply swap and place a negative sign in the result.
Hex Multiplication
Hex multiplication works like decimal but requires converting to and from hex during steps. Use a hex multiplication table if needed.
Example:
F A
× C 3
————-
2 E E (3 × FA)
+ B B 8 (C × FA)
————-
B E 6 ESteps include converting values to decimal, multiplying, adding carryovers, and converting results back to hex.
Hex Division
Hex division is very similar to long division in decimal. You divide, multiply, and subtract using hex values. You can also convert to decimal, do the division, and convert the result back to hex.
For example-based division and visual understanding, using a hex division table or calculator is highly recommended.
Example:D E F
┌────────────
12 ) F A C E
– E A
——-
1 0 C
– F C
——-
1 0 E
– 1 0 E
———
0Checks:
12 × D = EA
FA − EA = 10
12 × E = 10C
10C − FC = 10
12 × F = 10E
10E − 10E = 0Final Result: FACE ÷ 12 = DEF (all in hexadecimal)
Hexadecimal Multiplication Table