Hex to Decimal Converter
Type in any box — the others update as you go. Exact at any size, and it shows what the same bits mean as a signed value.
Read as a signed value
The same bits, interpreted in two's complement at each width.
| Width | Unsigned | Signed | Hex |
|---|
Converting hex to decimal by hand
Each digit has a place value that is a power of 16, counting from zero on the right.
Multiply, then add. For 2F:
| Digit | Value | Place | Contribution |
|---|---|---|---|
2 | 2 | 161 = 16 | 32 |
F | 15 | 160 = 1 | 15 |
| Total | 47 | ||
The same procedure works for any base — swap 16 for 2, 8 or whatever you have. Going the other way, divide repeatedly by the base and read the remainders bottom to top.
The digits, for reference
| Dec | Hex | Binary | Dec | Hex | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | 10 | A | 1010 |
| 3 | 3 | 0011 | 11 | B | 1011 |
| 4 | 4 | 0100 | 12 | C | 1100 |
| 5 | 5 | 0101 | 13 | D | 1101 |
| 6 | 6 | 0110 | 14 | E | 1110 |
| 7 | 7 | 0111 | 15 | F | 1111 |
Why hex at all, when we can count in decimal?
Because one hex digit is exactly four bits, and decimal lines up with nothing. That single fact is the whole reason hex exists in computing.
A byte is always two hex digits. A 32-bit value is always eight. Converting between hex and binary needs no arithmetic at all — you replace each hex digit with its four bits, straight off the table above:
3F → 0011 1111 → 00111111
Try that with decimal 63 and there is no shortcut; you have to actually divide. That is why memory addresses, colour codes, permission masks and register dumps are all written in hex. It is not tradition, it is that the boundaries land in the right places.
Two's complement, or why 0xFFFFFFFF is sometimes −1
This trips people up constantly, and it is the reason the panel above exists.
A run of bits does not carry any information about whether it is signed. Read
0xFFFFFFFF as an unsigned 32-bit number and it is 4,294,967,295.
Read the identical bits as a signed 32-bit number and it is −1.
Both are correct. Which one you want depends on what the code that produced it thinks
it is holding, and the hex alone cannot tell you.
The rule computers use is two's complement: if the top bit is set, the value is
negative, and its magnitude is the value subtracted from 2width. So at 8 bits,
0xFF is 256 − 255 = 1, hence −1. At 32 bits the same reasoning
gives −1 from 4,294,967,296 − 4,294,967,295.
The practical version: if you are staring at a suspiciously enormous number in a debugger — 4 billion, or 18 quintillion — it is almost always a small negative number being read as unsigned. Check the signed column.
Large numbers, and where converters go wrong
JavaScript's ordinary number type holds integers exactly only up to 253 − 1, about 9 quadrillion. Past that, values are rounded to the nearest representable one.
This matters more than it sounds, because a 64-bit register value, a Snowflake ID or
a truncated hash all exceed it comfortably. A converter built on parseInt
does not refuse those — it returns a number that looks entirely plausible and is
wrong in the last few digits. Nothing warns you.
This tool uses BigInt throughout, which is exact at any width. If you
want to check any converter for the problem, paste in
FFFFFFFFFFFFFFFF: the correct decimal answer is
18446744073709551615. A tool that ends in ...1616 or
...1600 is rounding.
How to use it
Type into whichever box matches what you have; the rest update on every keystroke.
Prefixes are optional — 0x1F, 1F and 1f are
all accepted, as are 0b and 0o. Underscores and spaces are
ignored, so 1010_1111 works. A minus sign is fine too, and the signed panel
will show how that value looks at each width.
Questions
How do I convert hex to decimal by hand?
Give each digit a place value that is a power of 16, counting from zero at the right, then add. For 2F: F is 15 in the ones place, 2 is in the sixteens place, so 2 × 16 + 15 = 47.
Why is hexadecimal used instead of decimal in computing?
One hex digit is exactly four bits, so hex lines up with binary perfectly and decimal does not. A byte is always two hex digits, a 32-bit value always eight, and you can convert hex to binary a digit at a time with no arithmetic.
What does 0x mean in front of a number?
It tells a programming language the digits are hexadecimal, since 10 in hex and 10 in decimal look identical. 0b marks binary, 0o octal. The prefixes are notation, not part of the value.
Why does 0xFFFFFFFF show as 4294967295 and not −1?
Because the same bits mean different numbers depending on whether the value is signed. Unsigned 32-bit it is 4,294,967,295; signed, in two's complement, it is −1. The hex alone does not say which, so the panel shows both.
Will very large numbers convert correctly?
Yes — this uses BigInt, which is exact at any size. Worth checking elsewhere: a converter built on JavaScript's Number loses precision above 253 and returns a plausible but wrong answer rather than an error.
Is anything I type sent to a server?
No. The conversion runs inside your browser and this page has no backend, so nothing you enter is transmitted, logged or stored.
Related tools
Browse all Sigma Wire tools - every free tool on the site, grouped by category.