Map Extract
Free tool

Hex calculator

Enter two hex values such as FF and 1A, pick an operation, and the result appears in hexadecimal with its decimal and binary forms. Below, convert any decimal whole number to hex.

Runs in your browser. Nothing you enter is uploaded.

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.

Input
FF + 1A
FF AND 0F
Result
119 (decimal 281, binary 100011001)
F (decimal 15)

Using the hex calculator

  1. 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.

  2. Select an operation

    Choose from +, −, ×, ÷, mod, AND, OR and XOR. Division gives the whole-number part; mod gives what is left over.

  3. Read three answers

    The result is shown in hex, with decimal and binary versions beside it for checking.

  4. 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

HexDecimalBinary
0 to 90 to 90000 to 1001
A101010
B111011
C121100
D131101
E141110
F151111

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

Top