Hex to decimal converter
Type a hex number (0x prefix optional) to get its decimal value and the working.
Prefixes 0b, 0o, 0x and spaces or underscores between digits are fine. A point starts the fraction.
How to convert hex to decimal
Hex digits run 0 to 9 and then A to F, where A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Each place is worth 16 times the place to its right: 1, 16, 256, 4096 and so on. Multiply each digit by its place value and add.
| Digit | Place value | Digit × place value |
|---|---|---|
| 1 | 162 = 256 | 256 |
| A (10) | 161 = 16 | 160 |
| 3 | 160 = 1 | 3 |
256 + 160 + 3 = 419, so 1A316 = 41910.
Hex digits
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
How it’s calculated
Conversions use exact whole-number arithmetic (JavaScript BigInt), so long numbers keep every digit. Fractions are kept as exact ratios; when the digits repeat, the repeating block is found and marked instead of rounded.
Questions
Is hex case sensitive?
No. 1a3 and 1A3 are the same number.
What does the 0x prefix mean?
It marks a number as hexadecimal in programming languages such as C, Java, JavaScript and Python. The converter accepts it and ignores it.
How do I read FF as a signed number?
Tick “Read as signed” and choose 8 bits: FF is 11111111, which is −1 in two’s complement. With 16 bits, 00FF is 255.