How do you convert hex to decimal?
Expand the number by place value. Each hex digit is worth 16 times the digit to its right, so the places are 1, 16, 256, 4096 and so on. Multiply each digit by its place value and add. Letters stand for 10 (a) through 15 (f). For 7E3, that's 7 × 256 + 14 × 16 + 3 = 2019.
This converter does the expansion instantly for values up to 53 bits (1fffffffffffff), and tells you plainly when a number is too large to handle exactly.
Using it
- Paste the hex digits, for example
1F600. Upper or lower case both work. - Remove any
0x,#orU+prefix. - Click Convert and copy the decimal result.
Worked example: 7E3, digit by digit
| Digit | Value | Position | Place value (16^n) | Product |
|---|---|---|---|---|
| 7 | 7 | 2 | 256 | 1792 |
| E | 14 | 1 | 16 | 224 |
| 3 | 3 | 0 | 1 | 3 |
| Total | 2019 |
Keep the powers of 16 handy and longer values are just more rows:
| Power | Place value |
|---|---|
| 16^0 | 1 |
| 16^1 | 16 |
| 16^2 | 256 |
| 16^3 | 4,096 |
| 16^4 | 65,536 |
| 16^5 | 1,048,576 |
| 16^6 | 16,777,216 |
| 16^7 | 268,435,456 |
Where hex numbers come from
Hex values turn up in places that expect you to know their decimal size. Three common ones:
Unicode code points. Characters are numbered in hex, written like U+1F600 in the Unicode code charts. Drop the U+ and convert 1F600 to get 128512, which is the number to use in a decimal HTML character reference such as 😀. The WHATWG HTML standard accepts both that and the hex form 😀.
HTTP chunk sizes. With chunked transfer coding, each chunk starts with its length in hex (RFC 9112, section 7.1). If a raw response shows 3e8 before a chunk, that chunk is 1000 bytes.
Integer limits in code and logs. 7fffffff is 2147483647, the largest signed 32-bit integer, and ffff is 65535. Seeing these in a crash log or a database column usually means something overflowed or hit a ceiling.
Signed or unsigned?
Hex is just a bit pattern, and the same pattern can be read two ways. This converter always reads it as an unsigned, positive number:
| Hex | Unsigned (tool output) | As signed 32-bit |
|---|---|---|
7fffffff |
2147483647 | 2147483647 |
80000000 |
2147483648 | -2147483648 |
ffffffff |
4294967295 | -1 |
If you know the value came from a signed 32-bit field and the result is 2,147,483,648 or more, subtract 4,294,967,296. For a 16-bit field the threshold is 32,768 and you subtract 65,536.
Inputs the converter rejects
0xff,#ff,U+1F600: prefixes aren't hex digits. Delete them.ff fforde:ad: spaces and separators inside the value. Join the digits.fg,12h: letters past f. Thehsuffix used in some assembly languages has to go too.-ff: no sign support.- Anything above
1fffffffffffff(leading zeros don't count): too large. JavaScript numbers are only exact up to 2^53 - 1, and the tool refuses to round.
Whitespace at either end is trimmed, and an empty box just clears the output.
Related tools
- Decimal to hex converts back, useful for building constants or color channels.
- Hex to binary shows the individual bits when you're decoding flags.
- HEX to RGB splits a six-digit color code into its three decimal channels for you.
- The HTML encoder and decoder handles character references once you have the code point.
Last updated