Hex Calculator
Do arithmetic directly in hexadecimal. Results are exact for any size and shown in hex, decimal and binary, with a decimal check line.
Hex arithmetic by hand
Addition works like decimal addition with a carry at 16 instead of 10. For FF + 1A: F + A = 15 + 10 = 25 = 16 + 9, so write 9 and carry 1; F + 1 + 1 = 17 = 16 + 1, write 1 and carry 1; the result is 119 (281 in decimal, which matches 255 + 26).
For subtraction, borrowing 1 from the next hex place gives you 16 in the current place. In 1000 − 1, the borrow passes through the two middle zeros, leaving FFF. The decimal check is 4096 − 1 = 4095.
Bitwise operations
AND, OR and XOR work bit by bit, which is where hex shines: each digit is four independent bits. DEADBEEF AND FFFF keeps only the low 16 bits, BEEF. That is the usual way to extract a field or truncate a value to a fixed width, for example AND FFFFFFFF to model a 32-bit register.
Results are exact at any size; nothing overflows. To see the bits of a result, use hex to binary; to interpret it as a negative number, the signed binary converter.
Related guides
Other Number System Conversions
Related numeral systems converters for number conversion between binary, decimal, hexadecimal, octal, and ASCII text.