Hex to Decimal: Hexadecimal Base 16 Converter
With the place-value working shown, not just the answer, because most people looking this up are trying to learn the method.
Enter hex digits only: 0 to 9 and A to F. A leading 0x is fine.
Show the working
How the conversion works
Every positional number system works the same way. Each digit is multiplied by the base raised to the power of its position, counting from zero at the right, and the results are added.
= 16 + 15 = 31
The letters A through F stand for 10 through 15, which is the only part of hex that isn't immediately obvious. Expand the working panel above and the tool shows this expansion for whatever you type.
Reference table
| Hex | Decimal | Binary | Octal |
|---|---|---|---|
| 0x0 | 0 | 0 | 0 |
| 0x1 | 1 | 1 | 1 |
| 0x8 | 8 | 1000 | 10 |
| 0x9 | 9 | 1001 | 11 |
| 0xA | 10 | 1010 | 12 |
| 0xB | 11 | 1011 | 13 |
| 0xC | 12 | 1100 | 14 |
| 0xD | 13 | 1101 | 15 |
| 0xE | 14 | 1110 | 16 |
| 0xF | 15 | 1111 | 17 |
| 0x10 | 16 | 10000 | 20 |
| 0x1F | 31 | 11111 | 37 |
| 0x20 | 32 | 100000 | 40 |
| 0x7F | 127 | 1111111 | 177 |
| 0x80 | 128 | 10000000 | 200 |
| 0xFF | 255 | 11111111 | 377 |
| 0x100 | 256 | 100000000 | 400 |
| 0xFFF | 4,095 | 111111111111 | 7777 |
| 0xFFFF | 65,535 | 1111111111111111 | 177777 |
Where hex turns up
Color codes are the most common encounter. A CSS color such as #1B5B43 is three bytes, one each for red, green and blue, written as two hex digits apiece.
Beyond that: memory addresses, MAC addresses, file signatures, character encodings and permission masks. The reason is always the same, that one hex digit is exactly four bits, so hex writes binary compactly without breaking byte alignment.
Common questions
How do I convert hex to decimal?
Multiply each hex digit by 16 raised to the power of its position, counting from zero at the right, then add the results. For 1F: F is 15 times 16 to the power 0, which is 15. The 1 is 1 times 16 to the power 1, which is 16. 15 plus 16 is 31.
What is FFFFFFFF in decimal?
4,294,967,295. That is the largest value a 32-bit unsigned integer can hold, which is why it turns up so often.
What is 12 hex in decimal?
0x12 is 18 in decimal. The 1 contributes 16 and the 2 contributes 2.
Why does computing use hexadecimal at all?
Because one hex digit maps exactly to four binary digits, so a byte is always exactly two hex digits. That makes hex a compact way to write binary without losing the alignment.
Related converters and guides
Sources
- Base conversion is arithmetic rather than a measured conversion, so there is no external factor to cite. The place-value method shown is the standard positional-notation definition: each digit is multiplied by the base raised to the power of its position, counting from zero at the right.