Skip to content
FiftyCalc Free calculators for all 50 states

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

Sample figures

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.

Binary Fraction Converter

Decimal number (0 to 32,767.99…): enter a number from 0 to 32,767.9999. Prefilled example: 10.625.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Decimal number (0 to 32,767.99…): enter a number from 0 to 32,767.9999.
  2. 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

  1. N1={floor⁡((x−floor⁡(x))×16)mod16if x≥0 and x<32,768No result for these inputsotherwise
Symbols used in the formula
SymbolMeaning
xDecimal number (0 to 32,767.99…)
N1Bits 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 binary1010
Bits 5 to 8 after the point0000
Bits 9 to 12 after the point0000
Exact in 12 bits?Yes: the binary fraction ends within 12 bits
Decimal value of the 12-bit binary number10.625
  1. N1=floor⁡((10.625−floor⁡(10.625))×16)mod16=10

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.

Related calculators