How to convert
- Positional expansion: multiply each digit by 16 to the power of its position (rightmost is 0) and add.
- In hex, A=10, B=11, C=12, D=13, E=14, F=15. Example: FF = 15×16¹ + 15×16⁰ = 240 + 15 = 255.
Notes
- Integers of any length are converted exactly — no scientific notation.
- Prefixes are accepted: 0x for hex, 0b for binary, 0o for octal; spaces and underscores are ignored.
- Negative numbers: prefix with "-". Fractions are not supported yet.
Hex to Decimal table
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 2 | 10 |
| 3 | 3 | 11 |
| 4 | 4 | 100 |
| 5 | 5 | 101 |
| 6 | 6 | 110 |
| 7 | 7 | 111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
| 10 | 16 | 1 0000 |
| 20 | 32 | 10 0000 |
| 40 | 64 | 100 0000 |
| 64 | 100 | 110 0100 |
| 7F | 127 | 111 1111 |
| 80 | 128 | 1000 0000 |
| FF | 255 | 1111 1111 |
| 100 | 256 | 1 0000 0000 |
| 3E8 | 1000 | 11 1110 1000 |
| 400 | 1024 | 100 0000 0000 |
| 1000 | 4096 | 1 0000 0000 0000 |
| FFFF | 65535 | 1111 1111 1111 1111 |