Number Base Converter: Base 2 to Base 36
CU-02Type a whole number, choose its base and the base you want, and the converted number appears. Bases 2 to 36 are supported, and long numbers stay exact.
Runs in your browser. Nothing is uploaded.
Numbers, one per line (whole numbers; 0b, 0o and 0x prefixes are understood when the input base is Auto)
Converted numbers
How to use it
- Type or paste whole numbers into the box, one per line. Sample loads four numbers, one with 30 digits.
- Pick the input base. Auto reads a 0x, 0b or 0o prefix and treats everything else as decimal.
- Pick the output base and press Convert, or press Show common bases to see the number in binary, octal, decimal, hex, base 32 and base 36.
- Tick the prefix, uppercase or show-input options if you want them, then copy or download the result.
How the conversion works
Each digit is read in the base you chose and the number is built up as a BigInt, which is an integer with no size limit, so a 30-digit or 300-digit number is converted exactly and never rounded the way a normal JavaScript number would be. The result is then written out in the output base. Digits above 9 are the letters a to z, which is why base 36 is the highest base: it uses all ten digits and all 26 letters.
What it accepts
Put one whole number on each line. Spaces and underscores inside a number are ignored, so 1111 0000 is one number, and a leading minus or plus sign is kept. The prefix that belongs to the input base (0b for binary, 0o for octal, 0x for hex) may be written in front. Fractions such as 1.5 are rejected with an error that says so, and a digit that does not exist in the chosen base is named. Leading zeros do not appear in the result.
Base 32 and base 36 here
The base 32 in the common-bases list uses the digits 0 to 9 and the letters a to v, the same rule as every other base on this page. It is not the Base32 encoding from RFC 4648, which uses a different alphabet and works on bytes of data, not on numbers. For that encoding, use a Base32 encoder instead. Base 36 is handy for short IDs, because a number written in it uses only letters and digits.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
"12" is not a valid binary number: "2" is not a binary digit. | A digit in the number does not exist in the input base you picked. | Check the input base. Here 2 is not allowed because binary only has 0 and 1. |
"1.5" has a ".". Only whole numbers are converted here, not fractions. | The number has a decimal point or comma. | Remove the fraction part, or convert the whole and fractional parts separately. |
Questions people ask
How do I convert a number to another base?
Enter the number, choose the base it is written in, choose the base you want, and press Convert. For example, 255 in base 10 becomes ff in base 16 and 11111111 in base 2. You can convert many numbers at once, one per line.
What is the highest base I can use?
Base 36. A base needs one symbol per digit value, and this page uses 0 to 9 followed by a to z, which gives 36 symbols. Upper and lower case letters are read as the same digit, and the result is lowercase unless you tick uppercase.
Can it convert very large numbers without rounding?
Yes. The numbers are held as BigInt, so a 100-digit number converts exactly. There is a limit of 20,000 digits per number to keep the page responsive, and an error tells you if you go past it.
Does it convert fractions or decimals like 0.5?
No. Only whole numbers are converted, and a number with a decimal point is rejected with a clear error instead of being rounded. Convert the integer part here and handle any fractional part separately, with a method suited to the base.
How do I convert a negative number?
Put a minus sign in front. The sign is kept and the digits are converted, so -255 in decimal becomes -ff in hex. This is a signed number, not a two's complement bit pattern, which depends on a fixed bit width.
About this tool
Pick an input base and an output base from 2 to 36; digits above 9 are the letters a to z, so base 36 uses all of 0-9 and a-z. "Show common bases" lists the same number in binary, octal, decimal, hexadecimal, base 32 and base 36 (this base 32 uses 0-9 and a-v, not the RFC 4648 Base32 alphabet used for encoding data). With the input base on Auto, a 0x, 0b or 0o prefix picks the base and anything else is read as decimal. It converts whole numbers only, using BigInt, so a number with hundreds of digits is converted exactly. Put one number per line; spaces and underscores inside a number are ignored (so 1111 0000 is one number), a leading - or + is kept, and the prefix that matches a base of 2, 8 or 16 is allowed. Leading zeros are not kept in the result, because the value is converted, not the text. Fractions such as 1.5 are rejected with an error, and a digit outside the chosen base is rejected and named.