Hex Calculator

Perform hexadecimal calculations—add, subtract, multiply, or divide. Convert between hexadecimal and decimal values with ease.

Hexadecimal Calculation

Convert Hexadecimal to Decimal

Hexadecimal Value:

Convert Decimal to Hexadecimal

Decimal Value:

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

HexBinaryDecimal
000
111
2102
3113
41004
51015
61106
71117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115
141010020
3F11111163

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:

2AA = (2 × 162) + (A × 161) + (A × 160)
= (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:

18 + B78 = ?
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:

5D1C - 3AF = ?
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

×0123456789ABCDEF
00000000000000000
10123456789ABCDEF
202468ACE10121416181A1C1E
30369CF1215181B1E2124272A2D
4048C1014181C2024282C3034383C
505AF14191E23282D32373C41464B
606C12181E242A30363C42484E545A
707E151C232A31383F464D545B6269
8081018202830384048505860687078
909121B242D363F48515A636C757E87
A0A141E28323C46505A646E78828C96
B0B16212C37424D58636E79848F9AA5
C0C1824303C4854606C7884909CA8B4
D0D1A2734414E5B6875828F9CA9B6C3
E0E1C2A38465462707E8C9AA8B6C4D2
F0F1E2D3C4B5A69788796A5B4C3D2E1

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.