Decimal to binary converter

Enter a whole or fractional decimal number to get its binary form in 4-bit groups, with the full working.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter decimal number and fraction digits if it does not end.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Whole part: divide by 2 again and again, note each remainder and read the remainders from last to first. Fraction part: multiply the fraction by 2 again and again and take the whole digit each time.

Example

Inputs: Decimal number = 42, Fraction digits if it does not end = 24. Result: Result in binary: 101010.

42
101010

Limits and caveats

  • Negative numbers keep a minus sign in front of the magnitude; they are not shown in two's complement.
  • Up to 2000 digits before the point and 200 after it.
  • A fraction that does not end in the new base is cut at the number of digits you choose, without rounding.

Questions about this tool

How do I convert 13 to binary by hand?

Divide by 2 and keep the remainders: 13 gives 6 r1, then 3 r0, then 1 r1, then 0 r1. Read them bottom up: 1101.

Why does 0.1 never end in binary?

Its denominator 10 contains the factor 5, and binary can only write fractions whose denominator is a power of 2 exactly, so the pattern 0011 repeats forever.

Can I convert a negative number?

Yes, the result keeps a minus sign, such as -101. For the fixed-width form computers use, open the two's complement tool.