Convert hex to decimal
To convert a hex value into decimal, take each digit and its position.
Each position holds a power of 16.
Multiply each digit by its power of 16, then add the results.
Try it
The value 0x12C, which is 300. Select a bit to change it. Change the bit width or the signed mode to see the effect.
Name or expression
ID0
ASCII
·,
Binary
0b
0b0000000100101100
Hex
0x
0x012C
Decimal
300
Shift
Name or expression
ID0
Binary
0b
Hex
0x
Decimal
ASCII
·,
Shift
Sign
Bits
Endian
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Worked example
Convert 0x12C into a decimal value:
- The digit C is in position 0. The value of C is 12. Multiply by 1 to get 12.
- The digit 2 is in position 1. Multiply by 16 to get 32.
- The digit 1 is in position 2. Multiply by 256 to get 256.
- Add the results: 12 + 32 + 256. The total is 300.
Where this is used
A crash dump and a register log both use hex.
A decimal form is easier to check against a range limit in a specification.
Points to note
- The digit A is 10 and the digit F is 15.
- A zero at the left does not change the value.
- A hex value of eight digits can exceed a 32-bit signed range. Check the signed mode of the register.
The full tool
The full editor holds many values at the same time. It also evaluates expressions across them, and it reads live values from a serial port.
Open the full editorQuestions
- What is 0xFF in decimal?
- The value 0xFF is 255. Both digits are 15, which gives 15 times 16 plus 15.
- What is 0xFFFFFFFF in decimal?
- As an unsigned 32-bit value it is 4294967295. As a signed 32-bit value it is -1.
- Is hex case sensitive?
- No. The values 0xff and 0xFF are the same.