Examples from colour codes and settings
Adding FF and 1A gives 119 in hex, which is 281 in decimal and 100011001 in binary. Web colour codes are three hex pairs, so arithmetic like this is handy when stepping a shade up or down by a fixed amount, though each pair has to stay between 00 and FF.
A bitwise AND of FF with 0F keeps only the lower four bits, giving F. This is the kind of masking used to read one setting packed inside a larger value, such as a single channel of a colour or a flag in a device register.
FF + 1A FF AND 0F
119 (decimal 281, binary 100011001) F (decimal 15)
Using the hex calculator
Type two hex values
Write each value with the digits 0 to 9 and the letters A to F; capitals and small letters both work, and a leading 0x is stripped.
Select an operation
Choose from +, −, ×, ÷, mod, AND, OR and XOR. Division gives the whole-number part; mod gives what is left over.
Read three answers
The result is shown in hex, with decimal and binary versions beside it for checking.
Convert from decimal
Type a base-10 number in the lower panel to get its hex form, with binary and octal included.
Hex digits at a glance
| Hex | Decimal | Binary |
|---|---|---|
| 0 to 9 | 0 to 9 | 0000 to 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Questions people ask
Why is hex used instead of decimal?
One hex digit stands for exactly four binary digits, so a byte is always two hex characters. That makes long binary values short and easy to read, which is why hex appears in colour codes, MAC addresses, error codes, file signatures and memory addresses.
What is 255 in hex?
FF. It is the largest value that fits in one byte, which is why each pair in a web colour code runs from 00 to FF. In binary 255 is eight ones, 11111111, and in octal it is 377. The decimal converter in the tool shows all three for any whole number.
Can the result be negative?
Yes. Subtracting a larger hex number from a smaller one gives a negative result, shown with a minus sign in hex and decimal. The tool does not wrap the answer into a fixed number of bits, so values are exact however large they are.
Where your data goes
Hexadecimal sums are computed by the page itself. The values you type stay in your browser and are never transmitted.
Checked against the tool on