Number Base Converter
Convert integers between binary, octal, decimal, hex and any base from 2 to 36, with big numbers, negatives and two’s complement.
Type an integer in any field and the others update. Signs are fine, and so are 0b, 0o and 0x prefixes.
Two’s complement
Enter a value to see its two’s complement pattern at a fixed bit width.
How to use
- Type an integer in the binary, octal, decimal, hexadecimal or custom field. The other fields update as you type.
- “Custom base” can be anything from 2 to 36; digits above 9 are the letters a–z.
- Turn on “Group digits” (4 digits for binary and hex, 3 otherwise) or “Uppercase letters” if you like.
- Under “Two’s complement”, pick 8, 16, 32 or 64 bits to see how a negative number is stored, or to read a pattern such as 0xFF as a signed number.
FAQ
How large can the numbers be?
The tool uses JavaScript BigInt, so integers have no fixed size limit and values beyond 64 bits stay exact. To keep the page responsive, each field takes up to 4,096 characters.
Does it convert fractions?
No. Fractions often have no finite form in another base (decimal 0.1 repeats forever in binary), so rather than show approximations the tool works with integers only.
How do the 0b, 0o and 0x prefixes work?
0b means binary, 0o octal and 0x hexadecimal, as in JavaScript and Python. Paste them into the matching field. In other fields a prefix is honored whenever its letter is not a digit of that base, and the tool says so. In the hex field b is a digit, so 0b1 is hex B1.
How are negative numbers shown?
Each base field uses a minus sign, so −255 is −ff. Computers usually store negative integers in two’s complement; pick a bit width under “Two’s complement” to see it, e.g. −1 in 8 bits is 1111 1111 (0xFF).
What is two’s complement?
With n bits, the patterns 0 to 2ⁿ − 1 represent the integers −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1: a negative x is stored as 2ⁿ + x. The same pattern can therefore be read as unsigned (255) or signed (−1).
Is my data uploaded?
No. Everything is converted in your browser, with no network connection needed.
Related tools
Text to Hex
Convert text to UTF-8 bytes in hex or decode hex back to text, with strict UTF-8 validation that points at the bad byte.Data Size Converter
Convert KB, MB, GB and TB side by side with KiB, MiB, GiB and TiB, plus bits and bytes, and see why a 1 TB drive shows 931 GB.Chmod Calculator
Tick read, write and execute boxes to convert Unix permissions between octal (755, 644) and rwxr-xr-x, with ready-to-run chmod commands.