Number base converter
Convert a number between binary, octal, decimal, hexadecimal and any base from 2 to 36, with no size limit and two's complement. Runs in your browser.
- Free
- No sign-up
- No file uploaded
- Windows, Mac, Android, iPhone
Loading the tool…
About this tool
Type a number in any base: its value instantly appears in binary, octal, decimal, hexadecimal and the base of your choice. Very large numbers are computed exactly, with no rounding, and negative numbers are also shown in two's complement on 8, 16, 32 and 64 bits.
When to use it
Reading a hexadecimal value
A colour code, a memory address, a Windows error code or a byte in a dump: convert it to decimal to know its value, or to binary to see which bits are set.
Building bit masks
For Unix permissions, API flags or microcontroller registers, write the value in binary, grouped by four digits, and get its hexadecimal form ready to paste into code with the 0x prefix.
Studying computer science
Base conversion and two's complement exercises are classics of computer architecture courses. The tool gives the result instantly so you can check a calculation done by hand.
How to use
- Type a number in the box for its base.
- Read its value in the other bases.
- Copy the result, with or without prefix.
How it works
Each digit has a value from 0 to 35 (0 to 9 then a to z). The number is read digit by digit and accumulated with JavaScript BigInt integers, which have no size limit: a 200-digit number is converted exactly, whereas floating-point arithmetic would lose precision beyond 2^53.
For display, the value is rewritten in each base; the grouping option separates digits by four in binary and hexadecimal, by three in decimal. Two's complement shows how a negative number is stored in memory at a given width, which explains, for example, why -1 is 0xFF in one byte.
Tips for best results
- In hexadecimal, each digit maps to exactly 4 bits: 0xF0 = 1111 0000. That is why hex is used to read binary.
- Paste a value straight from your code with its prefix (0x1F, 0b1010, 0o755): it is recognised in the matching box.
- Unix permissions are written in octal: 755 = rwxr-xr-x. Type them in the octal box to see the bits.
- For a negative number, look at the two's complement of the width your language uses (32 bits for an int in C or Java).
- Bases 32 and 36 are used to shorten numeric identifiers in web addresses.
Common problems and fixes
“Not a valid digit”
A digit is too large for the base: 2 does not exist in binary, 8 and 9 do not exist in octal. Check you are typing in the right box.
The result differs from my calculator
Many calculators round beyond 15 to 17 digits. Here, integers are computed exactly: the calculator is the one that is wrong.
I want to convert a decimal fraction
The tool converts integers. For the representation of a floating-point number (IEEE 754), you need a dedicated tool.
Frequently asked questions
Is there a size limit?
No: calculations use JavaScript BigInt. Only your device's memory limits the length of the number.
What is two's complement?
It is how computers store negative integers: invert the bits of the absolute value, then add 1. On 8 bits, -1 is written 11111111.
Do letters have to be uppercase?
No, 0xff and 0xFF are both accepted. The hexadecimal result is shown in lowercase, as in most languages.
Which bases are supported?
Every base from 2 to 36: beyond that, there are not enough digits and letters to write the values.
Related searches
Still stuck?
Ask on the forum: the category, the tool, your device sheet and the test result will be filled in for you.