Hex to Decimal Converter
To convert hex to decimal, multiply each hexadecimal digit by a power of 16, counting from 16^0 on the right, and add the results. For example 0xFF is 255, because F is 15 and 15 × 16 + 15 = 255. Enter a hex number below to see every step.
Decimal result
255
Working
- Write the place values from the right, starting at 16^0: the 2 digit(s) cover 16^1 down to 16^0.
- F × 16^1 = 15 × 16 = 240
- F × 16^0 = 15 × 1 = 15
- Add the products: 240 + 15 = 255.
Example: 0xFF to decimal
- Write the place values from the right, starting at 16^0: the 2 digit(s) cover 16^1 down to 16^0.
- F × 16^1 = 15 × 16 = 240
- F × 16^0 = 15 × 1 = 15
- Add the products: 240 + 15 = 255.
- Result: 255
- Largest signed 32-bit value: 7FFFFFFF = 2147483647
How hex digits map to values
Hexadecimal is base 16, so it needs sixteen symbols: 0-9 for the values zero to nine and A-F for ten to fifteen. The letters are not case sensitive, so ff, Ff and FF all read the same. The rightmost digit is worth 16^0 (1), the next 16^1 (16), then 256, 4096 and so on. The working shows each non-zero digit, its value and its place value, then the sum.
The converter accepts an optional 0x prefix, spaces or underscores between digits, and numbers of any length, because it uses arbitrary-precision integers. The largest signed 32-bit value, 7FFFFFFF, is 2147483647; there is no 32-bit or 64-bit ceiling in this tool.
Negative hex values and two’s complement
Negative numbers: a leading minus sign is treated as a sign and the digits are converted as the absolute value, so the sign is simply kept in front of the result. This is not two’s complement, which is how processors store negative integers and which depends on a fixed bit width. The tool does not assume a width, so it never reinterprets a high bit as a sign.
If you are reading a 32-bit signed value such as FFFFFFFF, convert it normally (4294967295) and, when the top bit is set, subtract 2^32 (4294967296). That gives -1. For 8 bits, subtract 256 instead.
Common mistakes
The most common error is a character that is not a hex digit, such as G, a decimal point or a comma. The tool names the character and tells you which digits are allowed. Fractions are not supported; enter whole numbers only.
Decimal, binary, hex and octal table (0-15)
| Decimal | Binary (4-bit) | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
Frequently asked questions
- What is 0xFF in decimal?
- 255. F is 15, so 15 × 16 + 15 = 255, the largest value of one byte.
- What is 0x7FFFFFFF in decimal?
- 2147483647, the largest signed 32-bit integer.
- Does it work without the 0x prefix?
- Yes. The prefix is optional; FF and 0xFF give the same answer.
- How do I convert hex to decimal by hand?
- Write each digit as a value from 0 to 15, multiply it by 16 raised to its position from the right, and add everything up.