Hex to Decimal Converter with Two's Complement
Convert between hex, decimal, binary, octal and any base 2–36 with BigInt precision and a signed view
Whole numbers only. Prefixes 0x / 0b / 0o, underscores and spaces are accepted in any field.
Two's complement
1111 1111
Hex to decimal, decimal to hex, binary and octal in one place
This number base converter shows the same integer in binary, octal, decimal and hexadecimal side by side, plus one custom base of your choice from 2 to 36. Type into any field and all the others update as you type, so hex to decimal, decimal to hex, binary to decimal and decimal to binary are all the same action. Everything is calculated in your browser.
Input is forgiving in the ways real-world values need. A 0x, 0b or 0o prefix is understood in any field — paste 0xFF into the decimal box and it is read as hex, giving 255 — and spaces or underscores used as digit separators (1111_0000, FF FF) are ignored. Letters are case-insensitive, and a leading minus sign works for negative numbers. If you type a digit that does not exist in that base, such as 9 in octal or G in hex, the error names the digit and lists the ones allowed.
All arithmetic uses JavaScript BigInt, so there is no upper limit and no silent rounding. Ordinary converters built on regular JavaScript numbers lose precision above 2^53 (9,007,199,254,740,992), which means a 64-bit ID or hash pasted into them comes back subtly wrong. Here a 128-bit or 256-bit value converts exactly. Binary output can be grouped in fours and hex in pairs to make long values readable, and every field has a copy button.
Signed values and two's complement
Computers store negative integers in two's complement: the bit pattern for -x is what you get by inverting every bit of x and adding one, within a fixed width. That is why -1 as an 8-bit value is 11111111 (hex FF), and why the same byte FF reads as 255 when treated as unsigned and -1 when treated as signed.
The two's complement panel shows the bit pattern of the current value in 8, 16, 32 or 64 bits, along with both readings of that pattern — signed and unsigned — and the hex form. Enter -1 with 32 bits selected and you see FFFFFFFF; enter 4294967295 and you see the same pattern with a signed value of -1. That makes it quick to decode a register dump, check how a C int8_t or Java byte will overflow, or work out what a negative number looks like on the wire. Values outside the chosen width, such as 256 in 8 bits, are reported as out of range rather than silently wrapped.
Limitations and custom bases
Only whole numbers are converted. Fractional values like 0.1 or 3.75 are rejected with a message instead of being truncated, because fractions often have no finite representation in another base (0.1 in binary repeats forever) and silently rounding them would give a misleading answer.
The custom base field covers any radix from 2 to 36 using the digits 0–9 followed by the letters A–Z, the same convention used by JavaScript's parseInt and toString, Python's int(x, base) and most other languages. Base 36 is handy for short IDs; base 32 and base 3 come up in puzzles and coursework. Note that base 32 here means plain positional notation, not the RFC 4648 Base32 encoding, which uses a different alphabet.
How to use the Hex to Decimal Converter with Two's Complement tool
- 1
Type into any field
Enter a value in binary, octal, decimal, hex or the custom base; the rest update instantly.
- 2
Use prefixes and separators freely
0x, 0b and 0o prefixes, underscores and spaces are all accepted.
- 3
Pick a custom base
Choose any base from 2 to 36 for the extra field.
- 4
Check the signed view
Select 8, 16, 32 or 64 bits to see the two's-complement pattern and its signed and unsigned values.
Frequently asked questions
How do I convert hex to decimal?
Multiply each hex digit by 16 raised to its position and add them: FF = 15×16 + 15 = 255. Typing FF (or 0xFF) into the hex field does this instantly.
What is -1 in binary?
It depends on the width. In 8-bit two's complement it is 11111111 (FF); in 32 bits it is 32 ones (FFFFFFFF). Select a width in the two's complement panel to see it.
Can it convert very large numbers?
Yes. It uses BigInt, so 64-bit, 128-bit and larger values convert exactly without the rounding that affects tools built on regular JavaScript numbers.
Does it convert fractions or decimals with a point?
No, it converts integers only. Fractional parts are rejected with a message rather than rounded, since many fractions repeat forever in other bases.
What is an octal converter used for?
Octal is mainly seen in Unix file permissions (chmod 755) and some older formats. The octal field converts those values to binary and decimal like any other base.
Related Converter Tools
Unix Timestamp Converter with Milliseconds
Convert Unix timestamps to human-readable dates and vice versa
Cron Expression Generator with Next Run Times
Build, explain and test cron expressions, with the next run times in UTC and your timezone
ENV to JSON
Convert .env files to JSON format
ENV to Docker Compose
Convert .env files to docker-compose environment snippet
Query String to JSON
Parse URL query strings into JSON objects
JSON to Query String
Convert JSON objects to URL query strings
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.

