Convert hex to decimal, or any number between hexadecimal, decimal, binary, octal and bases 2 to 36, and see the working: every digit times its place value for the conversion into decimal, and the repeated division for the way back. The converter also shows the signed two’s complement value, Gray code and the bits needed, and it stays exact for numbers far beyond 64 bits.
Type a number, pick the base it is written in, and every other base appears at once with a copy button. The working below the results shows exactly how the answer was reached, so you can check homework or a datasheet value by hand.
Multiply each hex digit by 16 raised to its position, counting from 0 at the right, then add the results. The letters A to F stand for the values 10 to 15.
Hex to decimal value = dₙ × 16ⁿ + … + d₂ × 16² + d₁ × 16¹ + d₀ × 16⁰
Example 7DE = 7 × 256 + 13 × 16 + 14 × 1 = 1,792 + 208 + 14 = 2,014
Example 3B = 3 × 16 + 11 = 59
The same method works for every base: binary uses powers of 2, octal powers of 8. Digits after a dot use negative powers, so hex 1A.8 is 16 + 10 + 8 ÷ 16 = 26.5.
Divide the decimal number by 16 again and again, write down each remainder, and stop when the quotient reaches 0. The remainders read from the last to the first are the hex digits.
Example: 61,453 to hex
61,453 ÷ 16 = 3,840 remainder 13 → D
3,840 ÷ 16 = 240 remainder 0 → 0
240 ÷ 16 = 15 remainder 0 → 0
15 ÷ 16 = 0 remainder 15 → F
Result read bottom up: F00D
Table 2 in the converter shows the same division for any number, into hex, binary or octal. For binary the divisor is 2, so each remainder is a 0 or a 1.
Each hex digit maps to exactly four binary digits, so you can convert between hex and binary digit by digit without going through decimal. That is why programmers write bytes as two hex digits: 1111 1111 is FF. Text is stored the same way, one number per character, and our ASCII art generator draws whole pictures with those printable characters.
| 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 |
Example: hex 2F = 0010 1111 in binary. Going the other way, split a binary number into groups of four from the right and look up each group: 1 1010 0110 = 1A6.
Some hex values come up again and again because they sit on a power-of-two boundary: FF is the largest byte, FFFF the largest 16-bit number and FFFFFFFF the largest 32-bit number.
| Hex | Decimal | Where you see it |
|---|---|---|
| 7F | 127 | largest signed 8-bit value |
| 80 | 128 | top bit of a byte; −128 as a signed byte |
| FF | 255 | largest byte; one color channel in #RRGGBB |
| 100 | 256 | values one byte can hold |
| 400 | 1,024 | 1 KiB |
| FFFF | 65,535 | largest unsigned 16-bit value |
| 7FFFFFFF | 2,147,483,647 | largest signed 32-bit integer |
| FFFFFFFF | 4,294,967,295 | largest unsigned 32-bit integer; −1 as a signed 32-bit value |
Memory sizes follow the same powers of two: 400 hex is 1,024 bytes, the binary kilobyte. Our MB to GB converter explains why storage makers count in 1,000s while Windows counts in 1,024s, and the bandwidth calculator handles bits versus bytes for network speeds.
The same bit pattern can mean two numbers: FF is 255 unsigned but −1 as a signed 8-bit value, because two’s complement treats a set top bit as negative. The converter shows both, and the signed width option lets you read a value as 8, 16, 32 or 64 bits.
JavaScript numbers lose precision above 2⁵³ − 1 (9,007,199,254,740,991). This converter uses BigInt arithmetic instead, so a 40-digit hex value converts exactly.
Multiply each hex digit by 16 to the power of its position, counting from 0 at the right, and add the products. A to F count as 10 to 15, so 2F = 2 × 16 + 15 = 47.
FF in hex is 255 in decimal: 15 × 16 + 15 = 255. It is the largest value one byte can store, and as a signed 8-bit number the same pattern means −1.
0x is a prefix that marks a hexadecimal number in programming languages such as C, Java, JavaScript and Python. 0x10 is 16, not ten.
Divide the number by 16 repeatedly and note each remainder until the quotient is 0, then read the remainders from last to first. 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, so 255 is FF.
Hexadecimal is a short way to write binary: one hex digit stands for exactly four bits and two digits for one byte. It is easier to read than long strings of 0s and 1s and converts to binary without any arithmetic.
0xFFFFFFFF is 4,294,967,295, the largest unsigned 32-bit number. Read as a signed 32-bit integer, the same bits mean −1.