How to use it
- Type or paste a number, for example
255,-0x1For1111 0000. - Choose the base it is written in, or “Automatic” to go by its prefix.
- Read it in binary, octal, decimal, hexadecimal and the extra base you choose; copy any line.
- Under “Two’s complement”, see its bit pattern in 8, 16, 32 and 64 bits.
Rules and limits
How numbers are read and written
- Input: a whole number, with
+or−in front if needed. Spaces and underscores anywhere are left out (1111 0000,0xff_ff); the rest is read exactly as Python’sint(text, base)reads it. Digits above 9 are the letters a–z in either case; base 36 uses all of them. - “Automatic” reads
0xas base 16,0oas base 8 and0bas base 2, anything else as decimal, asint(text, 0)does, so010is refused there. With a chosen base its own prefix is allowed (0xffin base 16), and0b1in base 16 is the number b1. - Only whole numbers: no fractions, exponents or decimal commas. Every result is exact (JavaScript BigInt), for up to 100,000 digits.
- Groups: 4 digits in bases 2, 8 and 16 and 3 in base 10, counted from the right, as Python’s
format(n, '_x')andformat(n, ',d')group them; other bases are not grouped. A negative number is written with a minus sign and its digits. - Two’s complement: the 8-, 16-, 32- and 64-bit rows where the number fits as signed (−2^(w−1) to 2^(w−1) − 1) or as unsigned (0 to 2^w − 1), with the bit pattern in hex and binary read both ways. 200 in 8 bits is the pattern c8, which read as signed is −56.
Tested limits
- Checked against Python 3.14: 20,001 random numbers in bases 2 to 36 and the automatic base (38 of them over 3,000 digits, the longest 100,000), with signs, prefixes, capitals, leading zeros, spaces and underscores, give the same value, every output, bit length and two’s complement row as Python’s
int(),format()andint.to_bytes(). Of 3,000 damaged texts the page reads exactly the 939 that Python reads, to the same numbers. - At most 100,000 digits. On the test laptop, headless Chrome showed 100,000 decimal digits 0.5 s after the typing stopped (0.2 s of it the typing pause). In Node.js 24, all five outputs with groups took 0.1 s for 100,000 binary digits and 0.3–0.6 s for 100,000 digits in bases 10, 16 and 36.
Questions and answers
Why is 0xFF −1 in the two’s complement table?
A byte carries no sign of its own. Read as signed, the top bit counts as −128, so 1111 1111 means −128 + 127 = −1; read as unsigned it is 255. Both readings are shown, because the bits alone do not say which one a program meant.
Can it convert fractions such as 0.1?
No. A fraction often has no finite form in another base (0.1 in binary repeats forever), so a result would have to be cut short, and the page gives only exact results.
Why does “Automatic” refuse 010?
Older C and JavaScript code read a leading zero as octal, so 010 could mean 8 or 10. Python refuses it to avoid the mix-up, and so does this page; choose base 8 or 10 to say which you mean.
Is my number sent anywhere?
No. It is converted in your browser and the page sends nothing. The typed number is kept only in this tab, like other tools’ options.