Convert between bases
Bases 2 to 36, signed integers, no loss of precision even with hundreds of digits.
- Binary11111111
- Octal377
- Decimal255
- HexadecimalFF
How to convert between bases
To go from decimal to another base, divide by the target base until the quotient hits zero. The remainders, read from bottom to top, spell the answer. To go the other way, multiply each digit by the base raised to its position and add everything up.
In hexadecimal, the digits 10 through 15 are written A through F. In larger bases the letters continue up to Z, which stands for 35 in base 36.
Binary, octal, and hex equivalents
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 1000 | 1111101000 | 1750 | 3E8 |
| 4096 | 1000000000000 | 10000 | 1000 |
Hex is common in web colors and memory addresses, and binary shows the bits inside a byte. One hex digit always maps to exactly 4 binary digits.
Precision, signs, and fractions
- Precision: the tool works with arbitrary-size integers, so a number like 2^100 converts exactly, with no rounding.
- Signs: a minus sign in front is kept, so −255 becomes −FF.
- Prefixes: 0x, 0b, and 0o are accepted at the start of the number.
- Fractions: not converted. Whole numbers only, because exact fraction conversion between bases can repeat forever.
Looking for file sizes in bytes, KB, or GB? Use the unit converter. For another number system, try Roman numerals.
Frequently asked questions
How do I convert decimal to binary?
Divide the number by 2 over and over and write down each remainder. Read the remainders from bottom to top: 13 becomes 1101.
How do I convert hex to decimal?
Multiply each digit by 16 raised to its position and add the results. FF is 15 × 16 + 15 = 255.
What is the largest base the converter supports?
Base 36, which uses the digits 0 to 9 and the letters A to Z. The letter Z stands for 35.
Does the converter lose precision with big numbers?
No. Integers of any practical size convert exactly, with no floating-point rounding.
Can I convert a number with a decimal point?
No. Only whole numbers are converted, since fractions can turn into endless repeating digits in another base.
Sources and method
Standard public-domain formulas. Every calculation is checked against independent numeric tests before it goes live.