Number base converter for bases 2 to 36
This base converter rewrites a whole number from one number base in another, from base 2 to base 36. Type the digits, set From base and To base, and select Convert number. It covers binary, octal, decimal and hexadecimal, keeps every digit of very large values exact, and runs in your browser.
Converted number
The same integer in your chosen base.
Exact whole-number conversion
How to use the base converter
Type or paste the number in the Number field. Write it with the digits of its own base, with no prefix such as 0x and no separators. The line below the field lists the digits that the current input base allows.
Choose From base and To base. Each menu offers every base from 2 to 36, with Binary (2), Octal (8), Decimal (10) and Hexadecimal (16) named, and the page opens on decimal to hexadecimal. The Swap bases button next to the menus exchanges the two bases. After a conversion it also moves the result into the Number field, so you can convert it back.
Select Convert number. The Converted number panel shows the result. Copy it with Copy result, or save it with Download TXT as a text file named after the output base, such as number-base-16.txt. Reset clears the number and returns to decimal to hexadecimal.
How base conversion works
Each digit is worth its value times a power of the base, counted from the right. In base 3, the number 1021 means 1 × 27 + 0 × 9 + 2 × 3 + 1 × 1, which is 34 in decimal. The converter reads your digits the same way, from left to right, multiplying the running total by the input base and adding each digit.
To write a decimal number in another base by hand, divide by the new base again and again and keep the remainders. For 13 in binary, 13 ÷ 2 is 6 remainder 1, 6 ÷ 2 is 3 remainder 0, 3 ÷ 2 is 1 remainder 1, and 1 ÷ 2 is 0 remainder 1. Read the remainders from last to first to get 1101.
For two bases that are not 10, go through the value. 2A in base 12 is 2 × 12 + 10 = 34, and 34 in base 5 is 114. The converter does this in one step, with whole-number arithmetic and no rounding.
Digits, letters and signs
Bases above 10 need more than ten digit symbols, so the converter uses the letters A to Z for the values 10 to 35. Hexadecimal uses 0 to 9 and A to F, so 255 is FF, and base 36 uses every letter, so ZZ is 1295 in decimal. Input letters can be upper or lower case, and results always use uppercase.
Each digit must be smaller than the input base. The digit 2 is rejected in binary, 8 in octal and G in hexadecimal, and the error returns you to the Number field. Spaces and line breaks around the number are ignored.
A leading plus sign, hyphen or minus sign (−) is accepted. The result drops the plus sign and any leading zeros, keeps a minus sign on negative values and turns −0 into 0. So +00255 in decimal gives FF, and −255 gives -FF. Negative results are a sign and a magnitude, not two's complement bits.
Limits
This converter handles whole numbers only. Input with a decimal point, such as 1.5, is rejected rather than rounded or cut, so binary fractions are out of scope. Commas, underscores and spaces inside the number are rejected too, so type 1000, not 1,000.
It does not detect prefixes or scientific notation. In hexadecimal, 0xFF is rejected because x is not a hex digit, so type FF. In hexadecimal, 1E3 is the whole number 483, while 1e3 is invalid in decimal.
Bases run from 2 to 36. Base64 is a text encoding, not a positional number base, and this page does not turn text or ASCII characters into binary.
There is no digit limit. Values past the safe JavaScript number range of 9,007,199,254,740,991 stay exact, so 9007199254740993 becomes 20000000000001 in hexadecimal. Browser memory is the practical limit on very long numbers, and Cancel stops a conversion that is still running.
Questions
How do I convert a number from base 10 to base 2?
Divide the number by 2, write down the remainder, and repeat with the quotient until it reaches 0. The remainders read from last to first are the binary digits, so 13 becomes 1101 and 255 becomes 11111111. Here, set From base to Decimal (10), To base to Binary (2) and select Convert number.
How do I convert a number from base 3 to base 10?
Multiply each digit by its place value, a power of 3 counted from the right, and add the results. For 1021 in base 3 that is 27 + 0 + 6 + 1 = 34. The converter uses the same place values: choose Base 3 under From base and Decimal (10) under To base, then convert.
How do I convert any base to another base?
Find the value of the number in decimal first, then write that value in the new base by repeated division. 2A in base 12 is 2 × 12 + 10 = 34, and 34 in base 5 is 114. The converter skips the middle step: set both bases and it gives 114 directly, with no rounding.
How do I convert base 2 to base 4?
Because 4 is 2 squared, each base 4 digit stands for exactly two binary digits. Split the binary number into pairs from the right, adding a leading zero if needed, and convert each pair: 00 is 0, 01 is 1, 10 is 2 and 11 is 3. So 11011 becomes 01 10 11, which is 123 in base 4.
What is 11111111 in binary?
11111111 in binary is 255 in decimal and FF in hexadecimal. It is eight 1 bits, the largest value one byte can hold, which is 2 to the power 8 minus 1. Convert it here by choosing Binary (2) under From base, then Decimal (10) or Hexadecimal (16) under To base.
Can I convert negative numbers or two's complement?
Negative numbers convert as a sign and a magnitude: −255 in decimal gives -FF in hexadecimal and -11111111 in binary. The converter does not read or write fixed-width two's complement, so −1 never becomes FFFFFFFF. For that, add 2 to the power of your bit width first: −1 plus 2 to the 32 is 4294967295, which is FFFFFFFF.