Binary Fraction Converter
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter a decimal number such as 10.625; the calculator writes it in binary, whole part and fraction bits after the binary point.
Result
Bits 1 to 4 after the point
Whole part in binary
- Bits 5 to 8 after the point
- Bits 9 to 12 after the point
- Exact in 12 bits?
- Decimal value of the 12-bit binary number
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Decimal number (0 to 32,767.99…): enter a number from 0 to 32,767.9999.
- Read the result: Bits 1 to 4 after the point; the panel also shows Whole part in binary, Bits 5 to 8 after the point, Bits 9 to 12 after the point, Exact in 12 bits? and Decimal value of the 12-bit binary number.
How this calculator works
The whole part is written in base 2 as usual. For the fraction, multiply by 2 again and again: each time the result reaches 1, the next bit is 1 and you keep only the part after the point; otherwise the bit is 0. Equivalently, bit k is floor(fraction × 2ᵏ) mod 2.
Only fractions whose denominator is a power of 2 end: 0.625 = 5/8 = 0.101 in binary. Others, such as 0.1, repeat forever (0.000110011…), which is why 0.1 cannot be stored exactly in a computer's binary floating point.
The formula
| Symbol | Meaning |
|---|---|
| Decimal number (0 to 32,767.99…) | |
| Bits 1 to 4 after the point | |
floor(x) | the largest whole number not above x. |
Worked example
| Decimal number (0 to 32,767.99…) | 10.625 |
|---|
| Whole part in binary | 1010 |
|---|---|
| Bits 5 to 8 after the point | 0000 |
| Bits 9 to 12 after the point | 0000 |
| Exact in 12 bits? | Yes: the binary fraction ends within 12 bits |
| Decimal value of the 12-bit binary number | 10.625 |
Bits 1 to 4 after the point 1010
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is 10.625 in binary?
1010.101: 10 = 1010 and 0.625 = ½ + ⅛ = 0.101.
What is 0.1 in binary?
0.0001 1001 1001 … repeating; 12 bits give 409/4096 ≈ 0.0999.