Number base converter
Enter a number, say which base it is written in, and see it in binary, octal, decimal and hexadecimal, plus one base of your choice up to 36. Large values stay exact.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Type the number.
- Pick the base it is written in (10 for ordinary numbers).
- Read the binary, octal, decimal and hexadecimal results. Choose an extra base to see a fifth value.
How it works
The number is read digit by digit: for each digit, the value so far is multiplied by the base and the digit is added. This gives one exact integer, which is then written out in each target base by repeated division.
Example: 255 in base 10 is 11111111 in binary (eight ones), 377 in octal and ff in hexadecimal, because 15 × 16 + 15 = 255.
Tips
- Each hex digit is exactly four bits, which is why hex is a compact way to write binary.
- Base 36 uses all digits and letters and is handy for short ids.
- Letters are accepted in any case; the output is lowercase unless you choose uppercase.
Frequently asked questions
How do I convert binary to decimal?
Choose base 2 under "Entered in base" and type the bits. For example 1111 1111 gives 255 in decimal and FF in hexadecimal. Spaces and underscores inside the number are ignored.
Which digits does each base use?
Bases up to 10 use the digits 0 to base minus 1. Above 10, letters continue the digits: a is 10, b is 11 and so on up to z, which is 35. That is why base 36 is the largest.
Is there a size limit?
No practical one. The numbers are calculated with arbitrary-precision integers, so values far beyond 2^53 stay exact, unlike in a calculator that uses floating point.
Can I convert fractions or negative numbers?
Negative whole numbers work, written with a minus sign, and are shown with a minus sign, not as two's complement. Fractions such as 1.5 are not supported.
What are the 0x, 0b and 0o prefixes?
They mark hexadecimal, binary and octal in many programming languages. If you chose the matching base, the prefix is accepted and ignored.