Hex Calculator: Add, Subtract, Multiply
To do math in hexadecimal, work in base 16: each digit runs from 0 to F, and you carry when a column reaches 16 instead of 10. 1A3F + FF = 1B3E, which is 6,719 + 255 = 6,974 in decimal. Type two hex numbers and pick an operation to get the answer in hex, decimal and binary.
Type a number and the answer appears straight away.
1A3F + FF =1B3Ein decimal: 6,719 + 255 = 6,974
- Result in hexadecimal
- 1B3E
- Result in decimal
- 6,974
- Result in binary
- 0001 1011 0011 1110
- First number in decimal
- 6,719
- Second number in decimal
- 255
The math behind it: Hex Calculator
Each hex digit is worth 16 times the digit to its right (A = 10, B = 11, C = 12, D = 13, E = 14, F = 15); carry 1 to the next column for every 16
Hex addition works like ordinary column addition, except a column carries once it reaches 16. In FF + 1, the right-hand F plus 1 makes 16, which is written 0 with 1 carried, and the carry ripples left, so the answer is 100 (255 + 1 = 256 in decimal). Subtraction borrows 16 instead of 10: 100 − 1 = FF and 1000 − 1 = FFF.
Multiplication and division follow the same rules. FF × FF = FE01, the hex form of 255 × 255 = 65,025, and A × A = 64, because 10 × 10 is 100 and 100 is written 64 in hex. Division gives a whole-number quotient and a remainder: FFFF ÷ 10 = FFF remainder F, or 65,535 ÷ 16 = 4,095 remainder 15. Numbers can be up to 64 hex digits long, enough for 256-bit values, and every digit of the result is exact.
The bitwise operations compare the two numbers one binary digit at a time, which is how programmers set and test flags and masks. F0 AND 3C = 30 keeps only the bits set in both, F0 OR 3C = FC keeps the bits set in either, and F0 XOR 3C = CC keeps the bits set in exactly one. The binary row groups the answer into fours, so each group lines up with one hex digit.
A negative result, such as A − F = -5, is shown with a minus sign rather than in the two's complement form a computer would store. To convert a single value between bases, use the hex to decimal converter or the binary converter, which also shows octal. For exact arithmetic on very long decimal numbers, try the big number calculator, and the scientific calculator handles everyday expressions.
Common questions
How do you add hexadecimal numbers?
Add each column from the right, and whenever a column reaches 16, write the amount over 16 and carry 1. 1A3F + FF = 1B3E, the same as 6,719 + 255 = 6,974 in decimal.
What is FF + 1 in hex?
100. F plus 1 is 16, which carries, and the carry ripples through both digits. In decimal that is 255 + 1 = 256.
How do you subtract in hex?
Subtract column by column and borrow 16 from the next column when the top digit is smaller. 100 − 1 = FF, and 1000 − 1 = FFF, which is 4,096 − 1 = 4,095.
What is FF times FF in hex?
FE01. In decimal that is 255 × 255 = 65,025. A two-digit hex number times another always fits in four hex digits.
How does hex division work?
It gives a whole-number quotient and a remainder. FFFF ÷ 10 = FFF remainder F, because 65,535 ÷ 16 = 4,095 remainder 15. Dividing by 10 in hex drops the last digit, just as dividing by 10 does in decimal.
You might also need
Checked and updated: