Using the converter
Type a hex number and the decimal value appears as you type. Swap to go from decimal to hex. Several numbers can go in at once, separated by spaces, commas or new lines. Prefixes like 0x and 0b are fine, and so is the _ character used to group digits, as in 1001_1100. Numbers can be as long as you like and can be negative, but they have to be whole: there's no decimal point.
Show the steps opens the working under the answer, line by line, the same way you'd set it out on paper. It shows the first four numbers when there are several.
How to convert hex to decimal
Each place in a hex number is worth 16 times the place to its right: 1, 16, 256, 4096 and so on. Multiply each digit by its place value, reading A to F as 10 to 15, and add them up.
For 1F4: 1 × 256 is 256, F × 16 is 15 × 16, which is 240, and 4 × 1 is 4. Added together that's 500.
How to convert decimal to hex
Divide by 16 and note the remainder, then divide the answer by 16 again until it reaches 0. Write any remainder from 10 to 15 as a letter from A to F, and read the remainders from the bottom up.
For 500: 500 ÷ 16 is 31 remainder 4, 31 ÷ 16 is 1 remainder 15, which is F, and 1 ÷ 16 is 0 remainder 1. From the bottom up that's 1F4.
Hex colour codes
A web colour like #FF0099 is three hex numbers side by side: FF for red, 00 for green and 99 for blue. Each pair runs from 00 to FF, which is 0 to 255 in decimal. Put FF0099 in with a space after every two digits, FF 00 99, and you get 255 0 153, the same colour written as RGB.
Decimal, binary, octal and hex from 0 to 32
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 17 | 10001 | 21 | 11 |
| 18 | 10010 | 22 | 12 |
| 19 | 10011 | 23 | 13 |
| 20 | 10100 | 24 | 14 |
| 21 | 10101 | 25 | 15 |
| 22 | 10110 | 26 | 16 |
| 23 | 10111 | 27 | 17 |
| 24 | 11000 | 30 | 18 |
| 25 | 11001 | 31 | 19 |
| 26 | 11010 | 32 | 1A |
| 27 | 11011 | 33 | 1B |
| 28 | 11100 | 34 | 1C |
| 29 | 11101 | 35 | 1D |
| 30 | 11110 | 36 | 1E |
| 31 | 11111 | 37 | 1F |
| 32 | 100000 | 40 | 20 |
Decimal, binary, octal and hex from 0 to 32stringmash.com/hex-to-decimal
Questions
What is FF in decimal?
255. F is 15, so FF is 15 × 16 + 15.
What does 0x mean in front of a number?
It marks the number as hexadecimal in C and the many languages that copied it, so 0x10 is 16 rather than ten. The converter accepts it and ignores it.
Does it matter if I type capitals or lowercase?
No. ff and FF are the same number. The Hex letters setting picks which one you get back.






