Number Base Converter
Type in any field and the others follow. Works with numbers of any size, negative values, and any base from 2 to 36, with a two's complement view for fixed-width integers.
How base conversion works
Every base writes the same number with a different set of digits. Decimal uses 0–9; hexadecimal adds A–F for 10–15, so one hex digit is exactly four binary bits; octal digits are three bits each. Bases above 16 keep going through the alphabet up to Z = 35, which is how base 36 fits a large number into a short string.
This converter uses JavaScript BigInt, so a 200-digit number converts exactly. Ordinary JavaScript numbers lose precision above 253 (9,007,199,254,740,992), and the details panel tells you when a value is past that point.
Two's complement
Computers store negative integers in two's complement: to get −x in n bits, take 2n − x. The top bit (marked in the grid) then acts as the sign. So −1 in 8 bits is 1111 1111 (0xFF), and 0xFF read as a signed 8-bit integer is −1 while read as unsigned it is 255.
Pick a width to see both readings. If your number is too big for that width, the tool keeps the low bits, which is what a cast such as (int8_t) or & 0xFF does in code.
Questions
How do I convert hex to decimal by hand?
Multiply each digit by 16 raised to its position, counting from 0 on the right, and add them up. 0x2F = 2 × 16 + 15 = 47.
What does the 0x prefix mean?
It marks a number as hexadecimal in most programming languages. Similarly 0b marks binary and 0o marks octal. You can paste values with or without these prefixes.
Why is FFFFFFFF sometimes -1 and sometimes 4294967295?
They are the same 32 bits. As a signed 32-bit integer (two's complement) they mean −1; as an unsigned integer they mean 4,294,967,295. Choose 32 bits in the two's complement panel to see both.
Does it support fractions?
No. The converter works with whole numbers only, positive or negative, of any size.