HEX CALCULATOR
HEXADECIMAL ARITHMETIC
HEX TO DECIMAL
DECIMAL TO HEX
HOW TO USE
Hex Arithmetic: Enter two hex values and select an operator
Hex to Decimal: Convert hexadecimal numbers to decimal
Decimal to Hex: Convert decimal numbers to hexadecimal
Hexadecimal Number System (Hex)
The hexadecimal number system (hex) functions virtually identically to the decimal and binary systems. Instead of using a base of 10 or 2 respectively, it uses a base of 16.
Hex uses 16 digits including 0-9, just as the decimal system does, but also uses the letters A, B, C, D, E, and F (equivalent to a, b, c, d, e, f) to represent the numbers 10-15. Every hex digit represents 4 binary digits, called nibbles, which makes representing large binary numbers simpler.
For example, the binary value of 1010101010
can be represented as 2AA
in hex. This helps computers to compress large binary values in a manner that can be easily converted between the two systems.
Typical Conversions 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 |
Converting Between Decimal and Hex
Converting between decimal and hex involves understanding the place values of the different number systems. Converting between decimal and hex is quite similar to converting between decimal and binary. The ability to perform the conversion of either should make the other relatively simple.
Hex functions using the base of 16. This means that for the value 2AA
, each place value represents a power of 16. Starting from the right:
- The first “A” represents the “ones” place, or 160.
- The second “A” represents 161.
- The “2” represents 162.
Remember that “A” in hex is equivalent to 10 in decimal. Knowing this, you can convert from hex to decimal as shown:
Example:
2AA = (2 × 16²) + (A × 16¹) + (A × 16⁰)
= (2 × 256) + (10 × 16) + (10 × 1)
= 512 + 160 + 10 = 682
Steps for Converting Decimal to Hex
- Find the largest power of 16 less than or equal to the decimal number (X).
- Determine how many times this power of 16 fits into X.
- Multiply the result by the power of 16 and subtract this from X to get a new value (Y).
- Assign the result to its position (16⁴, 16³, etc.).
- Repeat until 16 is larger than the remainder. Assign the remainder to the 16⁰ position.
Example: Convert decimal 1500 to hex
(1) Largest power = 16² = 256
(2) 256 × 5 = 1280
(3) 1500 - 1280 = 220
(4) 16 × 13 = 208
(5) 220 - 208 = 12
(6) 16 is larger than 12, so 12 is the 16⁰ position
(7) 1500 = (5 × 16²) + (13 × 16¹) + (12 × 16⁰)
(8) 13 = D, 12 = C in hex
(9) Hex value of 1500 = 5DC
Hex to Decimal Conversion
Example: Convert hex 1024 to decimal
(1) (1 × 16³) + (0 × 16²) + (2 × 16¹) + (4 × 16⁰)
(2) 4096 + 0 + 32 + 4 = 4132
Hex Addition
Hex addition follows decimal rules but includes A-F. Below is an example:
Example:
1 8 1A B
+ B 7 8
= 1 4 2 3
Explanation:
- B + 8 = 11 + 8 = 19 decimal → 13 hex (carry 1)
- 1 + A (10) + 7 = 18 decimal → 12 hex (carry 1)
- 1 + 8 + B (11) = 20 decimal → 14 hex
Hex Subtraction
Hex subtraction works like decimal but borrowings involve 16 rather than 10:
Example:
5 D 1C
- 3 A F
= 2 2 D
Explanation:
- Borrowing turns D into C; lends 16 to C (12+16=28).
- 28 – F (15) = 13 (D in hex).
- Remaining subtraction: C – A = 12 – 10 = 2, 5 – 3 = 2.
Hex Multiplication
Hex multiplication requires more attention to conversions. Below is an example:
Example:
F A (3 × A = 1E, carry 1 to F)
× C 3 (3 × F = 2D, +1 = 2E)
2 E E (C × A = 78, carry 7 to F)
+ B B 8 0 (C × F = B4, +7 = BB)
= B E 6 E
Hex Division
Hex division is like decimal long division but uses hex values directly. You may convert to decimal and back if easier. Borrowing uses 16, not 10.
A hexadecimal multiplication table can simplify calculations.
Hexadecimal Multiplication Table
Related Calculators:
Sample Size Calculator, Quadratic Formula CalculatorExternal Resources:
Hexadecimal Calculator on calculator.net