Number base converter

Enter one number in From. Optional 0b, 0o or 0x must match From. Parentheses mark repeating digits; p/q uses From for both integers. Exact conversion keeps the full value when its preview is shortened.

Change the notation while keeping the value

Choose From and To, then enter one number. Binary uses 0–1, octal 0–7, decimal 0–9, and hexadecimal 0–9 and A–F. A prefix is optional, but 0b, 0o or 0x must match From. A leading minus applies to the whole value.

Digits to the left of the point multiply powers of the base; digits to the right divide by those powers. Parentheses mark repeating digits: 0.0(0011) in binary repeats 0011 after its first fractional zero. You can also enter p/q, with both integer parts written in From. The Value field accepts a number, rather than an arithmetic expression.

Conversion uses exact integer ratios. Division gives the whole-number digits; multiplying each fractional remainder by the new base gives the next digit and remainder. Zero ends the expansion, while a repeated remainder identifies a cycle. A long preview may be shortened. Copy value keeps the complete typed value for reuse in a calculator expression.

Worked example: hexadecimal FF is decimal 255

Choose hexadecimal for From and decimal for To. Enter 0xFF or FF. Each F is 15, so 15×16+15=255. In binary the same value is 0b11111111.

Fractions use the same place values: 0b101.01 is 4+1+1/4=21/4, and 0xA.F is 10+15/16=175/16.

For decimal 0.1, begin with the ratio 1/10. Multiplying successive remainders by 2 gives digits 0,0,0,1,1 and then repeats the remainder 2. The exact binary notation is 0b0.0(0011). Its parentheses describe an infinite cycle; stopping after a few digits would change the value.

Load example fills the form without calculating. Choose its primary action to work it out.

Sources and related calculators

The method and worked example here are original. Sources describe the underlying mathematics or notation; calculation choices and limits are in the precision and syntax guide.