Hex to Decimal Converter
Convert hexadecimal to decimal, or decimal to hex, as you type. Exact for any length, with the signed reading of 32-bit and 64-bit error codes.
Open source on GitHubNumber
Whole numbers of any size. A leading minus sign, 0x / 0b / 0o prefixes, and spaces or underscores between digits are fine.
Result
Decimal (base 10)
500
Binary (base 2)
1 1111 0100
Octal (base 8)
764
Hexadecimal (base 16)
1 F4
9 bits · 3 decimal digits
Two’s complement
Bit pattern
0000 0000 0000 0000 0000 0001 1111 0100
Hex
0x00 00 01 F4
As signed integer
500
As unsigned integer
500
Runs entirely in your browser. Nothing you type here is uploaded or stored.
0x1F4 to decimal, digit by digit. Each position is worth 16 times the one to its right.
| Hex digit | Place value | Decimal |
|---|---|---|
| 1 | 1 × 16² = 1 × 256 | 256 |
| F | 15 × 16¹ = 15 × 16 | 240 |
| 4 | 4 × 16⁰ = 4 × 1 | 4 |
| Sum | 256 + 240 + 4 | 0x1F4 = 500 |
Hex values you will meet while debugging. Limits, colors, and error codes.
| Hex | Decimal | Where you see it |
|---|---|---|
| 0xFF | 255 | Largest unsigned byte; one RGB color channel at full intensity |
| 0x100 | 256 | One more than a byte can hold |
| 0x3E8 | 1,000 | A round decimal number in hex |
| 0xFFFF | 65,535 | Largest unsigned 16-bit value; highest TCP/UDP port number |
| 0x7FFFFFFF | 2,147,483,647 | Largest signed 32-bit integer (INT_MAX) |
| 0xFFFFFFFF | 4,294,967,295 | Largest unsigned 32-bit value; −1 when read as a signed 32-bit integer |
| 0x80070005 | 2,147,942,405 | Windows HRESULT for “access denied”. Signed 32-bit reading: −2,147,024,891 |
| 0xDEADBEEF | 3,735,928,559 | A classic debug fill value for uninitialized memory |
Hex digit chart. Sixteen digits, each exactly four bits.
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
More free tools. Free, open source, no sign-up. See all tools · Source on GitHub
Frequently asked questions
How do I convert hex to decimal?
Multiply each hex digit by 16 raised to its position, counting from 0 on the right, and add the results. Letters stand for 10 to 15 (A = 10, F = 15). For 0x1F4: 1 × 256 + 15 × 16 + 4 × 1 = 500. Paste any hex value above and the decimal result appears as you type.
How do I convert decimal to hex?
Divide the decimal number by 16 and note the remainder, then divide the quotient by 16 again until it reaches 0. The remainders read from bottom to top, with 10–15 written as A–F, are the hex digits. 500 ÷ 16 = 31 r 4, 31 ÷ 16 = 1 r 15 (F), 1 ÷ 16 = 0 r 1, so 500 = 0x1F4. Press Swap to convert in that direction.
What does 0x mean in front of a number?
0x is the prefix most programming languages use to mark a hexadecimal literal, so 0x10 means sixteen rather than ten. It is not part of the value. This converter accepts hex with or without 0x, and also with a leading # as in CSS colors.
Why does a hex error code show as a negative number in my logs?
Many error codes are 32-bit values with the top bit set, such as Windows HRESULTs starting with 0x8. When a program prints them as a signed 32-bit integer, they come out negative: 0x80070005 becomes −2,147,024,891. Choose 32-bit in the two’s complement panel to see both readings side by side.
Is there a limit to how long the hex value can be?
No practical limit. The converter uses BigInt, so 64-bit hashes, 128-bit UUIDs written as hex, and longer values convert exactly. Regular JavaScript numbers lose precision above 0x1FFFFFFFFFFFFF (2^53 − 1).