A hex to decimal converter turns a hexadecimal number, like 2AF or 0xFF, into the ordinary base-10 number it stands for. Type any hex value above and you'll get the exact decimal result, the value of every digit, and how the same bits read as a signed number. Here's how hex to decimal conversion works by hand, a faster shortcut, and the values worth knowing by heart.
What the digits A to F mean
Hexadecimal is base 16, so it needs sixteen digits. After 0 to 9 it uses letters: A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. A single hex digit therefore covers the values 0 to 15, which is exactly what four bits can hold. That's why programmers use hex as shorthand for binary, and why converting hex to decimal comes up so often when you read code, memory dumps or color values.
Converting hex to decimal with place values
Each position in a hex number is worth 16 times the one to its right. From the right, the place values are 1, 16, 256, 4,096, 65,536 and so on, the powers of 16. To convert, multiply each digit by its place value and add up the results. For 2AF, the 2 sits in the 256s place, the A (10) in the 16s place and the F (15) in the ones place. That's 2 × 256 + 10 × 16 + 15 × 1, or 512 + 160 + 15, which is 687. The Digit by digit table in the converter does exactly this for any hex number you type.
A faster method: multiply by 16 and add
For long numbers there's a shortcut that avoids working out big powers of 16. Start with the first digit. Then, for each digit after it, multiply your running total by 16 and add the digit. For 2AF: start with 2, then 2 × 16 + 10 = 42, then 42 × 16 + 15 = 687. You get the same answer with smaller numbers at every step, which makes it the easier method for mental arithmetic and the one most programs use.
Common hex values in decimal
| Hex | Decimal | Why it matters |
|---|---|---|
| FF | 255 | Largest value of one byte |
| 100 | 256 | One more than a byte can hold |
| 3E8 | 1,000 | — |
| FFFF | 65,535 | Largest 16-bit value |
| 10000 | 65,536 | 16⁴ |
| 7FFFFFFF | 2,147,483,647 | Largest signed 32-bit integer |
| FFFFFFFF | 4,294,967,295 | Largest unsigned 32-bit integer |
A useful pattern: a hex number made of n F's is always 16ⁿ − 1, the largest value that fits in that many digits.
Signed hex values
The converter gives the plain, unsigned value of your hex number. Inside a computer, though, the same bits can also be read as a signed integer using two's complement, where the top bit counts as negative. In 32 bits, FFFFFFFF is 4,294,967,295 unsigned but −1 signed, and 80000000 is −2,147,483,648. A quick check: if a full-width value starts with a digit from 8 to F, its signed reading is negative. The Signed and unsigned table shows both readings at 8, 16, 32 and 64 bits, and the two's complement calculator explains why.
Where you'll convert hex to decimal
- Colors. A color like
#FF8000is three hex bytes. Converting each pair gives red 255, green 128 and blue 0. The RGB to hex converter does both directions. - Unicode. Code points are written in hex, so
U+00E9(é) is character 233. - Error codes and addresses. Windows error codes, memory addresses and register values are usually shown in hex, while documentation and calculations often need decimal.
- Network and file data. Packet captures and hex editors show bytes in hex, two digits per byte.
Hex to decimal in code
Most programming languages convert hex to decimal in a single call. In JavaScript, parseInt("2AF", 16) returns 687, and so does Number("0x2AF"). In Python, int("2AF", 16) gives 687, and a literal like 0x2AF is already a number. Watch out for size limits: JavaScript numbers lose precision above 2⁵³, so very long hex values need BigInt("0x…"). This converter uses exact arithmetic, so it's a handy way to check a result. You can also check through binary: 2AF is 0010 1010 1111, and 1010101111 is 512 + 128 + 32 + 8 + 4 + 2 + 1 = 687.
Practical notes
- A
0xprefix is fine, and spaces or underscores between digits are ignored, so0xDEAD_BEEFworks. - There's no size limit. Long values convert exactly, without the rounding you'd get in a spreadsheet.
- To see the bits as well, use the hex to binary converter, or the hex converter for decimal, binary, octal and text at once.
A handy check: a hex number's value is always less than 16 to the power of its length, so any 4-digit hex number is below 65,536 and any 8-digit one is below 4,294,967,296.