Hex Calculator
Perform hexadecimal calculations—add, subtract, multiply, or divide. Convert between hexadecimal and decimal values with ease.
Hexadecimal Calculation
Convert Hexadecimal to Decimal
Convert Decimal to Hexadecimal
Hexadecimal Number System
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.
Hex/Decimal Conversion Table
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 |
Related Calculators
Hexadecimal Quick Facts
- •Hexadecimal is base-16, using digits 0-9 and letters A-F
- •Each hex digit represents exactly 4 binary digits (nibble)
- •Widely used in computing and programming for memory addresses and color codes
- •Web colors are often represented as 6-digit hex values (e.g., #FFFFFF for white)
Understanding Hexadecimal Calculations
Converting Between Hexadecimal and Decimal
Converting between decimal and hex involves understanding the place values of the different number systems. Hexadecimal 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" from the right represents 161, and the 2 represents 162. Remember that "A" in hex is equivalent to 10 in decimal.
Example Conversion:
= (2 × 256) + (10 × 16) + (10 × 1)
= 512 + 160 + 10 = 682
Hexadecimal Addition
Hex addition follows the same rules as decimal addition with the only difference being the added numerals A, B, C, D, E, and F. It may be convenient to have the decimal equivalent values of A through F handy when performing hex operations.
Example Addition:
B + 8 in decimal is 11 + 8 = 19 (13 in hex)
Carry over 1 to next column
1 + A (10) + 7 = 18 (12 in hex)
Carry over 1 to final column
1 + 8 + B (11) = 20 (14 in hex)
Result: 1423 in hex
Hexadecimal Subtraction
Hex subtraction can be computed much the same way as hex addition. The most significant difference between hex and decimal subtraction involves borrowing. When borrowing in hex, the "1" that is borrowed represents 1610 rather than 1010.
Example Subtraction:
C (12) - F (15) requires borrowing
Borrow 16 from next column (now 12 + 16 = 28)
28 - 15 = 13 (D in hex)
Next column: C (12) - A (10) = 2
Final column: 5 - 3 = 2
Result: 22D in hex
Hexadecimal Multiplication Table
× | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
2 | 0 | 2 | 4 | 6 | 8 | A | C | E | 10 | 12 | 14 | 16 | 18 | 1A | 1C | 1E |
3 | 0 | 3 | 6 | 9 | C | F | 12 | 15 | 18 | 1B | 1E | 21 | 24 | 27 | 2A | 2D |
4 | 0 | 4 | 8 | C | 10 | 14 | 18 | 1C | 20 | 24 | 28 | 2C | 30 | 34 | 38 | 3C |
5 | 0 | 5 | A | F | 14 | 19 | 1E | 23 | 28 | 2D | 32 | 37 | 3C | 41 | 46 | 4B |
6 | 0 | 6 | C | 12 | 18 | 1E | 24 | 2A | 30 | 36 | 3C | 42 | 48 | 4E | 54 | 5A |
7 | 0 | 7 | E | 15 | 1C | 23 | 2A | 31 | 38 | 3F | 46 | 4D | 54 | 5B | 62 | 69 |
8 | 0 | 8 | 10 | 18 | 20 | 28 | 30 | 38 | 40 | 48 | 50 | 58 | 60 | 68 | 70 | 78 |
9 | 0 | 9 | 12 | 1B | 24 | 2D | 36 | 3F | 48 | 51 | 5A | 63 | 6C | 75 | 7E | 87 |
A | 0 | A | 14 | 1E | 28 | 32 | 3C | 46 | 50 | 5A | 64 | 6E | 78 | 82 | 8C | 96 |
B | 0 | B | 16 | 21 | 2C | 37 | 42 | 4D | 58 | 63 | 6E | 79 | 84 | 8F | 9A | A5 |
C | 0 | C | 18 | 24 | 30 | 3C | 48 | 54 | 60 | 6C | 78 | 84 | 90 | 9C | A8 | B4 |
D | 0 | D | 1A | 27 | 34 | 41 | 4E | 5B | 68 | 75 | 82 | 8F | 9C | A9 | B6 | C3 |
E | 0 | E | 1C | 2A | 38 | 46 | 54 | 62 | 70 | 7E | 8C | 9A | A8 | B6 | C4 | D2 |
F | 0 | F | 1E | 2D | 3C | 4B | 5A | 69 | 78 | 87 | 96 | A5 | B4 | C3 | D2 | E1 |
Frequently Asked Questions
Why use hexadecimal instead of decimal or binary?
Hexadecimal is particularly useful in computing because it can represent large binary numbers more compactly. Each hex digit corresponds to exactly 4 binary digits (a nibble), making conversions between binary and hex very straightforward. This is especially helpful when working with memory addresses or binary data.
How do I know if a number is hexadecimal?
Hexadecimal numbers are often prefixed with "0x" (like 0x1A3) or suffixed with "h" (like 1A3h) to distinguish them from decimal numbers. In programming, the prefix notation (0x) is most common. Without these indicators, context is needed to determine if a number is hexadecimal.
Can hexadecimal represent fractions or negative numbers?
Yes, hexadecimal can represent fractions (using a hexadecimal point) and negative numbers (typically using two's complement notation in computing). However, this calculator focuses on whole number hexadecimal operations.
What are some common uses of hexadecimal?
Hexadecimal is commonly used in computer science for memory addressing, color codes in web design (like #FFFFFF for white), debugging, and representing binary data in a more human-readable form. It's also used in assembly languages and low-level programming.
How do I handle overflow in hexadecimal calculations?
Similar to decimal, when adding two hex numbers results in a sum greater than F (15 in decimal), you carry over 1 to the next higher digit. For example, F + 1 = 10 in hex (which is 16 in decimal). This calculator handles these conversions automatically.