Hex to Decimal
Type a hex value and get its decimal number, with each digit's share of the total laid out. Prefixes such as 0x and # are fine.
The converter could not load. Refresh the page to try again.
How it was worked out
Reading a hex number
Hexadecimal counts in sixteens, so it needs sixteen different digits. After 9 it runs out of ordinary digits and borrows letters. Case doesn't matter, so ff and FF are the same value.
| A | B | C | D | E | F |
|---|---|---|---|---|---|
| 10 | 11 | 12 | 13 | 14 | 15 |
Each place is worth sixteen times the one to its right.
| Position from the right | Power | Worth |
|---|---|---|
| 1 | 16^0 | 1 |
| 2 | 16^1 | 16 |
| 3 | 16^2 | 256 |
| 4 | 16^3 | 4,096 |
| 5 | 16^4 | 65,536 |
| 6 | 16^5 | 1,048,576 |
| 7 | 16^6 | 16,777,216 |
Method 1: multiply by powers of 16
Here's 2AF, one digit at a time.
Turn letters into numbers
A is 10 and F is 15, so the digits are 2, 10 and 15.
Multiply each digit by its place
2 × 256 = 512, then 10 × 16 = 160, then 15 × 1 = 15.
Add the results
512 + 160 + 15 = 687.
Method 2: keep a running total
Going from left to right, multiply your total by 16 and add the next digit. It's easier on a basic calculator, because you never need to work out 16 to the power of anything.
2AF: 2, then 2 × 16 + 10 = 42, then 42 × 16 + 15 = 687
Two-digit values in your head
One byte is two hex digits, and that's the size you'll convert most often. Multiply the first digit by 16 and add the second. For C8, that's 12 × 16 + 8 = 200.
Going past 9 in the second digit doesn't change anything. 2F is 2 × 16 + 15 = 47. And it's worth rememberingFF, the largest byte at 255. Anything close can be counted back from it, so FD is 253.
Hex to decimal chart
These turn up again and again. Select one to see its working above.
Where you'll convert hex in real life
Reading a colour code
A code like #FF8800 is three bytes, one each for red, green and blue. The table below shows what design tools mean by rgb(255, 136, 0).
Looking up a character
Unicode writes characters in hex. The waving hand emoji is U+1F44B, and in HTML you can write that same character using its decimal number, 128075.
Making sense of an error code
Windows often shows errors in hex, such as 0x80070005. A program may report that same code as 2,147,942,405, or as a negative number if it reads it as signed.
| Channel | Hex | Decimal |
|---|---|---|
| Red | FF | 255 |
| Green | 88 | 136 |
| Blue | 00 | 0 |
Where answers usually go wrong
Reading 10 as ten
In hex, 10 means one sixteen and no units, which is 16. The 0x prefix exists to stop this confusion.
Multiplying by 10 out of habit
Places go 1, 16, 256, 4,096, not 1, 10, 100, 1,000. Hex 3E8 uses 256 for its first digit.
Treating letters as 1 to 6
A is 10, not 1. If you find this hard to remember, count up from A = 10 on your fingers. There's no shame in it.
Converting a whole colour code at once
#FF8800 as a single number is 16,746,496, which isn't what anyone wants. Split it into pairs first.
Try these yourself
Work each one out on paper before you open it.
What is 1F in decimal?
31, because 1 × 16 + 15 = 31.
What is C8 in decimal?
200, because 12 × 16 + 8 = 200.
What is 3E8 in decimal?
1,000. That's 3 × 256 + 14 × 16 + 8, which is 768 + 224 + 8.
Common questions
What is FF in decimal?
It's 255, the largest value that fits in one byte.
What does the 0x mean?
It's a label that means "this number is hex". It's not part of the value, so 0x10 and 10 both mean 16 here.
Why do programmers use hex at all?
One hex digit is exactly four bits, so it's a short way to write binary. See hex to binary for how that works.
Can a hex number be negative?
You can write −2A here and get −42. In computer memory, though, negatives are usually stored in two's complement, so FF can mean −1 in a signed byte. This page gives the plain value, which is 255.
How long can the value be?
Up to 4,096 hex digits, with no rounding. The working is shown for values up to 64 bits, which is 16 hex digits.
Is my value sent anywhere?
No. The conversion runs in your browser, so it never reaches our server. A link you copy from the address bar can contain the value.