Hex Calculator
- Updated
- Formula shown
- Free, no sign-up
Results
2F + A = 39 in hex (57 in decimal)
Hex digits: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. A column overflows at 16, so 16 is written 10.
Work column by column from the right. When a column adds up to 16 or more, write the amount over 16 and carry 1; when it would go below 0, borrow 16 from the next column.
carry 1
2F
+ A
──
39
Result: 39
Check in decimal: 47 + 10 = 57How to use the hex calculator
- Choose Hex arithmetic to add, subtract, multiply or divide two hex numbers, or Convert to change a number from one base to the others.
- Type hex digits 0–9 and A–F in either case. A
0xprefix and spaces are ignored, and a leading minus is allowed for +, − and ×. - Read the result in hex with its decimal, binary and octal forms, and open the working to follow each step.
Numbers can have up to 64 hex digits (256 bits), 78 decimal digits, 256 binary digits or 86 octal digits, and every result is exact.
Hexadecimal formulas
Decimal to hex: divide by 16 repeatedly; the remainders, last to first, are the digits
Hex ↔ binary: each hex digit = 4 bits · octal ↔ binary: each octal digit = 3 bits
Hexadecimal uses sixteen digits, 0 to 9 and then A to F for ten to fifteen. Each digit dᵢ is worth 16 times the digit to its right, so the places are 1, 16, 256, 4,096 and so on. Because 16 = 24, one hex digit always matches exactly four binary digits, which is why hex is the shorthand of choice for memory addresses, color codes and byte values.
Worked examples
Adding 2F + A
carry 1
2F
+ A
──
39 F + A is 15 + 10 = 25 = 16 + 9, so write 9 and carry 1. Then 2 + 1 = 3. The answer, 39, is 47 + 10 = 57 in decimal.
Multiplying 2F × 1A
2F
× 1A
───
1D6 2F × A
2F 2F × 1, shifted 1 place
───
4C6 2F × A: F × A = 150 = 9 × 16 + 6, write 6 carry 9; 2 × A + 9 = 29 = 16 + 13, write D carry 1; so 2F × A = 1D6. Adding the shifted row 2F gives 4C6, which is 47 × 26 = 1,222.
Converting 2F to decimal and binary, and 2024 to hex
2F₁₆ = 2 × 16¹ + 15 × 16⁰ = 32 + 15 = 47₁₀. For binary, write each digit as 4 bits: 2 = 0010 and F = 1111, so 2F = 0010 1111.
- 2024 ÷ 16 = 126 remainder 8
- 126 ÷ 16 = 7 remainder 14 (E)
- 7 ÷ 16 = 0 remainder 7
Reading the remainders from the last to the first, 2024 = 7E8 in hex.
Hex, decimal, binary and octal from 0 to 15
| Decimal | Hex | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 2 | 2 | 0010 | 2 |
| 3 | 3 | 0011 | 3 |
| 4 | 4 | 0100 | 4 |
| 5 | 5 | 0101 | 5 |
| 6 | 6 | 0110 | 6 |
| 7 | 7 | 0111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| 10 | A | 1010 | 12 |
| 11 | B | 1011 | 13 |
| 12 | C | 1100 | 14 |
| 13 | D | 1101 | 15 |
| 14 | E | 1110 | 16 |
| 15 | F | 1111 | 17 |
Useful values
| Decimal | Hex | Binary |
|---|---|---|
| 16 | 10 | 1 0000 |
| 32 | 20 | 10 0000 |
| 64 | 40 | 100 0000 |
| 100 | 64 | 110 0100 |
| 127 | 7F | 111 1111 |
| 128 | 80 | 1000 0000 |
| 255 | FF | 1111 1111 |
| 256 | 100 | 1 0000 0000 |
| 1,000 | 3E8 | 11 1110 1000 |
| 1,024 | 400 | 100 0000 0000 |
| 4,096 | 1000 | 1 0000 0000 0000 |
| 65,535 | FFFF | 1111 1111 1111 1111 |
| 65,536 | 10000 | 1 0000 0000 0000 0000 |
| 16,777,215 | FFFFFF | 1111 1111 1111 1111 1111 1111 |
Tips and common mistakes
- 10 in hex is sixteen. When a result looks like a decimal number, check which base it is in; this calculator labels each one.
- Carry at 16, not 10. 9 + 8 in hex is 11 (one sixteen and one), not 17.
- Color codes are three bytes. #FF8800 is red FF = 255, green 88 = 136 and blue 00 = 0.
- Negative numbers in programs are usually stored in two's complement rather than with a minus sign. To see a negative value as 8, 16, 32 or 64 bits, use the binary calculator.
- For decimal numbers far longer than a normal calculator can hold, try the big number calculator.
Frequently asked questions
How do you convert hex to decimal?
Multiply each digit by a power of 16, starting with 16⁰ = 1 on the right, and add. Letters stand for 10 to 15 (A = 10 … F = 15). For example, 2F = 2 × 16 + 15 × 1 = 47.
How do you convert decimal to hex?
Divide by 16 repeatedly and note each remainder, then read the remainders from the last to the first. For 2024: 2024 ÷ 16 = 126 r 8, 126 ÷ 16 = 7 r 14 (E), 7 ÷ 16 = 0 r 7, so 2024 = 7E8 in hex.
What is FF in decimal?
FF is 15 × 16 + 15 = 255, the largest value that fits in one byte (8 bits, 1111 1111 in binary). That is why each color channel in a web color such as #FF8800 runs from 00 to FF.
Why do programmers use hexadecimal?
Each hex digit stands for exactly 4 bits, so a byte is always two hex digits and long binary values become short and readable: 1111 1011 is FB. Converting between hex and binary needs no arithmetic, just a lookup of each digit.
How do you add hex numbers?
Add column by column from the right as in decimal, but carry when a column reaches 16. For 2F + A: F + A = 15 + 10 = 25, which is 1 sixteen and 9, so write 9 and carry 1; then 2 + 1 = 3. The answer is 39 in hex, which is 47 + 10 = 57 in decimal.