Hex to Decimal Converter
Type a hex number and get the decimal value as you type, with the binary and signed values too. Works with 0x, # and long numbers. Switch direction to go from decimal to hex.
7E4 = 7×256 + 14×16 + 4 = 2020
0x, # and h are fine. Separate several numbers with spaces or new lines.
2020
How to Convert Hex to Decimal
Hex (hexadecimal) counts in sixteens instead of tens. It uses the digits 0–9 and then the letters A–F for ten to fifteen. Each place is worth 16 times the place to its right, so to convert:
- Write down the value of each digit. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
- Starting from the right, multiply the digits by 1, 16, 256, 4,096 and so on.
- Add the results. That's the decimal number.
| Place (from the right) | Worth | As a power of 16 |
|---|---|---|
| 1st | 1 | 16⁰ |
| 2nd | 16 | 16¹ |
| 3rd | 256 | 16² |
| 4th | 4,096 | 16³ |
| 5th | 65,536 | 16⁴ |
Worked Example: 7E4 to Decimal
Convert the hex number 7E4 to decimal.
Step 1: Write each digit's value
Step 2: Multiply by the place values, from the right
Step 3: Add them up
Result: 7E4 in hex = 2020 in decimal. The tool above opens with this number loaded.
Hex to Decimal Chart (00 to FF)
Every two-digit hex value. Find the first digit down the side and the second along the top: for example, row B, column 4 gives B4 = 180. FF = 255 is the largest two-digit value, which is why colour codes and bytes stop there.
| First digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| 2 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
| 3 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
| 4 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
| 5 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
| 6 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 |
| 7 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
| 8 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 |
| 9 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 |
| A | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 |
| B | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 |
| C | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 |
| D | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 |
| E | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 |
| F | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 |
Bigger values worth knowing:
| Hex | Decimal |
|---|---|
| 100 | 256 |
| 3E8 | 1,000 |
| 400 | 1,024 |
| FFF | 4,095 |
| 1000 | 4,096 |
| 2710 | 10,000 |
| FFFF | 65,535 |
| F4240 | 1,000,000 |
| FFFFFF | 16,777,215 |
Where You See Hex Numbers
Most people meet hex in one of these places, and each one is read a little differently:
| Where | Example | In decimal |
|---|---|---|
| Web and design color codes: each pair is one channel | #FF8800 | 255, 136, 0 (red, green, blue) |
| Windows error codes | 0x80070005 | 2,147,942,405, also shown as −2,147,024,891 |
| Unicode characters and HTML codes | U+00E9 (é) | 233, written é in HTML |
| Number literals in code | 0x1F4 | 500 |
Don't convert a whole color code as one number: #FF8800 as a single number is 16,746,496, which isn't useful. Convert each pair instead, or use the HEX to RGB converter.
Why FF Can Mean 255 or −1
Read as an ordinary number, FF is 255. But computers often store negative numbers by counting back from the top of the range, so in a program that expects a signed byte, FF means −1. That is why the same Windows error code shows up as a large positive number in one place and a negative number in another. The tool shows both readings whenever a value has 2, 4, 8 or 16 digits and starts with 8 or higher.
| Hex | Ordinary number | Signed number |
|---|---|---|
| 7F (2 digits) | 127 | 127 |
| 80 (2 digits) | 128 | −128 |
| FF (2 digits) | 255 | −1 |
| FFFF (4 digits) | 65,535 | −1 |
| 80070005 (8 digits) | 2,147,942,405 | −2,147,024,891 |
Hex to Decimal in Excel, Python and JavaScript
| Tool | How | Result for 7E4 |
|---|---|---|
| Excel or Google Sheets | =HEX2DEC("7E4") | 2020 |
| Python | int("7E4", 16) | 2020 |
| JavaScript | parseInt("7E4", 16) | 2020 |
| JavaScript (very long numbers) | BigInt("0x7E4") | 2020n |
| Windows Calculator | Programmer mode → HEX → type 7E4 → read DEC | 2020 |
Excel's HEX2DEC takes up to 10 hex digits and treats a 10-digit value starting with 8 or higher as negative, so =HEX2DEC("FFFFFFFFFF") gives −1. In JavaScript, parseInt starts losing accuracy past about 15 decimal digits; use BigInt for long values.
Frequently asked questions
What is FF in decimal?
FF is 15 × 16 + 15 = 255. It is the largest number two hex digits can hold, which is why it appears so often in colors and bytes.
What does the 0x in front of a hex number mean?
It just marks the number as hex, so 0x10 isn't mistaken for ten. 0x10 is 16. The tool ignores the 0x, as well as a # or a trailing h.
Does uppercase or lowercase matter?
No. 7e4 and 7E4 are the same number.
How do I convert hex to binary instead?
Swap each hex digit for its 4-bit pattern: 7E4 becomes 0111 1110 0100. The binary row in the tool shows it, or use the hex to binary converter for lists of values.
Sources
- Microsoft Support: HEX2DEC function: the 10-character limit and how negative values are read.
- Microsoft Learn: Common HRESULT values: Windows error codes such as 0x80070005 (access denied).
- MDN: parseInt(): reading hex strings with radix 16.
Related Tools
Convert Base64 encoded data into hexadecimal values.
Convert hexadecimal values into Base64 encoded data.
Convert binary values into hexadecimal numbers.
Convert CMYK color values into HEX color codes.
Convert HEX color codes into CMYK color values.
Convert decimal integers into hexadecimal values.