Decimal to binary fraction converter
To convert a decimal fraction to binary, convert the whole-number part as usual, then multiply the fraction by 2 again and again: each time, the whole part of the result (0 or 1) is the next bit after the binary point. 10.625 becomes 1010.101. Type a number below to see every step, and the repeating bits for values like 0.1 that never end in binary; switch direction to turn a binary number with a point back into exact decimal.
How the conversion works
Places after the binary point are worth halves, quarters, eighths and so on: 0.1 in binary is 1/2, 0.01 is 1/4, 0.001 is 1/8. Doubling a fraction shifts it one binary place to the left, so the bit that crosses the point is the next digit. For 0.625: 0.625 x 2 = 1.25 (bit 1, keep 0.25), 0.25 x 2 = 0.5 (bit 0), 0.5 x 2 = 1.0 (bit 1, nothing left). Reading the bits in order gives 0.101. The whole-number part uses the usual method, shown in the binary converter.
The other direction is a sum: each 1 bit contributes its place value, so 101.011 is 4 + 1 + 1/4 + 1/8 = 5.375.
Examples from the converter
| Decimal | Binary | Fraction bits |
|---|---|---|
| 10.625 | 1010.101 | ends after 3 bits |
| 2.75 | 10.11 | ends after 2 bits |
| 0.375 | 0.011 | ends after 3 bits |
| 0.1 | 0.0(0011) | repeats forever |
| 0.2 | 0.(0011) | repeats forever |
| 0.3 | 0.0(1001) | repeats forever |
| 6.4 | 110.(0110) | repeats forever |
Brackets mark the block that repeats. A decimal fraction ends in binary only when its denominator, in lowest terms, is a power of 2: 0.625 is 5/8, so it ends; 0.1 is 1/10, so it repeats.
Why it matters in a computer
Hardware has a fixed number of bits, so a repeating fraction has to be cut and rounded. That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages. Numbers with a fraction are stored either in fixed point, with the binary point at an agreed position, or in floating point, which you can take apart bit by bit in the IEEE 754 float converter; fixed point vs floating point compares the two.
Frequently asked
How do you convert a decimal fraction to binary?
Convert the whole-number part as usual. For the fraction, multiply it by 2: the whole part of the result (0 or 1) is the next bit after the binary point. Keep the fractional remainder and repeat until it reaches 0 or starts repeating. For 0.625: 1.25 gives 1, 0.5 gives 0, 1.0 gives 1, so 0.625 = 0.101.
Why can't 0.1 be written exactly in binary?
A fraction ends in binary only if its denominator, in lowest terms, is a power of 2. 0.1 is 1/10, and 10 has the factor 5, so the bits repeat forever: 0.0001100110011... Computers store a rounded copy, which is why 0.1 + 0.2 is not exactly 0.3 in floating point.
How do you convert a binary fraction to decimal?
Give each bit after the point its place value, 1/2, 1/4, 1/8 and so on, and add the values of the 1 bits. 0.101 is 1/2 + 1/8 = 0.625, so 1010.101 is 10.625. Every binary fraction has a finite decimal form.
What is 0.5 in binary?
0.1, because the first place after the binary point is worth 1/2. Likewise 0.25 is 0.01, 0.75 is 0.11 and 0.125 is 0.001.
What does the bracket in 0.0(0011) mean?
The bits in brackets repeat forever, like a recurring decimal: 0.0(0011) is 0.000110011001100... The converter finds the repeating block exactly by noticing when a remainder comes back.
How are binary fractions stored in a computer?
Either as fixed point, with the binary point at an agreed position, or as floating point (IEEE 754), which stores a sign, an exponent and a fraction of fixed width, so repeating values are rounded to that width.
Inputs accept up to 30 digits on each side of the point; the binary expansion shows up to 32 fraction bits, with a repeating block found exactly when there is one.
Related tools: binary converter, base converter, float converter, two's complement calculator and binary calculator.
Open the lab →