How to do hexadecimal arithmetic
- Enter two hex numbers using 0–9 and A–F. A 0x prefix is fine.
- Choose the operation.
- Read the hex result with the decimal, binary and octal values.
Example
0x1F4 + 0x2C = 0x220, which is 500 + 44 = 544 in decimal. Each hex digit is four bits, so 0x220 is 0010 0010 0000 in binary.
Hex digits
| Hex | Decimal | Binary |
|---|---|---|
| 0–9 | 0–9 | 0000–1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Hex in everyday computing
Colour codes like #1F2430 are three hex bytes for red, green and blue. Memory addresses, MAC addresses and file signatures are all written in hex because each pair of hex digits is exactly one byte, so it’s much shorter than binary and lines up with it perfectly.