Fraction to Decimal Converter | Repeating & Terminating
Convert fractions to decimals with repeating-block detection, or convert terminating decimals back to simplified fractions. Supports mixed numbers and shows full step-by-step long division working.
Press Enter to convert · Esc to reset
What Is the Fraction to Decimal Converter | Repeating & Terminating?
Fractions and decimals are two notations for the same underlying rational number. A fraction n/d expresses a ratio; a decimal expresses the same value in base-10 positional notation. Converting between them is a fundamental skill in arithmetic, and understanding why some decimals terminate while others repeat forever helps build genuine mathematical fluency.
Why Some Decimals Terminate and Others Repeat
After simplifying a fraction to lowest terms, the decimal terminates if and only if the denominator's prime factorisation contains only the primes 2 and 5. Since our decimal system is base 10 (= 2 × 5), these are the only primes that “go evenly into” a power of 10.
- ›Terminates: 1/8 = 1/2³ → 0.125 | 3/20 = 3/(4×5) → 0.15 | 7/40 → 0.175
- ›Repeats: 1/3 → 0.(3) | 1/6 = 1/(2×3) → 0.1(6) | 1/7 → 0.(142857)
- ›Max period length: For 1/p (p prime), the period is at most p−1 digits long (Fermat's little theorem)
Long Division and the Repeating Block
The long division algorithm works by tracking the remainder at each step. Because remainders are integers in the range [0, d−1], after at most d steps a remainder must repeat. The digits produced between the first and second occurrence of that remainder form the repeating block, this is guaranteed by the Pigeonhole Principle.
Converting Decimals Back to Fractions
For terminating decimals the conversion is exact: count k decimal places, write the decimal over 10ᵏ, then simplify by the GCD. For repeating decimals the algebraic method is used, multiply by 10ⁿ (where n is the period length) and subtract to eliminate the repeating part. For example, x = 0.(142857) → 999999x = 142857 → x = 142857/999999 = 1/7.
Formula
| Symbol | Name | Description |
|---|---|---|
| n | Numerator | The integer above the fraction bar; can be negative |
| d | Denominator | The integer below the fraction bar; must be non-zero |
| w | Whole part | Integer portion of a mixed number; carries the sign for negatives |
| GCD | Greatest Common Divisor | Largest integer that divides n and d exactly, used to simplify |
| k | Decimal places | Count of digits after the decimal point; used for the place-value denominator 10ᵏ |
| r | Remainder | Residue after each division step in long division; when r repeats, the cycle is found |
| p | Period length | Number of digits in the repeating block; e.g. 1/7 has period 6 (142857) |
How to Use
- 1Choose direction: Select Fraction → Decimal, Decimal → Fraction, or Mixed Number → Decimal from the tabs.
- 2Try a preset: Click any quick-example button to load a pre-filled case, useful for understanding terminating vs. repeating results.
- 3Enter your values: For fractions: type the numerator and denominator. For mixed numbers: type the whole part, numerator, and denominator. For decimals: type the decimal value.
- 4Convert: Press Convert or hit Enter on any input field. Results appear instantly.
- 5Read the result: The primary banner shows the conversion equation. A badge indicates whether the decimal terminates or repeats (with period length).
- 6Check the stat cards: Four cards show the decimal value, percentage, simplified fraction, and decimal-place or cycle-length count.
- 7Expand steps: Open "Step-by-step working" to see the GCD simplification, long division reasoning, or place-value calculation.
- 8Copy or reset: Copy the full result to your clipboard in one click. Press Reset or Esc to clear all fields and start fresh.
Example Calculation
Example 1, Terminating: 7/8
Denominator 8 = 2³, only factor-2, so the decimal terminates.
Example 2, Repeating: 1/7
Denominator 7 is prime with no factors of 2 or 5, produces a 6-digit repeating block.
Example 3, Decimal to Fraction: 0.625
Three decimal places → multiply top and bottom by 10³ = 1000, then simplify.
Understanding Fraction to Decimal Converter | Repeating & Terminating
Common Fraction–Decimal Equivalents
| Fraction | Decimal | Type | Period |
|---|---|---|---|
| 1/2 | 0.5 | Terminating | — |
| 1/3 | 0.(3) | Repeating | 1 |
| 1/4 | 0.25 | Terminating | — |
| 1/5 | 0.2 | Terminating | — |
| 1/6 | 0.1(6) | Repeating | 1 |
| 1/7 | 0.(142857) | Repeating | 6 |
| 1/8 | 0.125 | Terminating | — |
| 1/9 | 0.(1) | Repeating | 1 |
| 1/11 | 0.(09) | Repeating | 2 |
| 1/12 | 0.08(3) | Repeating | 1 |
| 3/4 | 0.75 | Terminating | — |
| 2/3 | 0.(6) | Repeating | 1 |
| 5/6 | 0.8(3) | Repeating | 1 |
| 22/7 | 3.(142857) | Repeating | 6 |
| 355/113 | 3.14159292... | Repeating | 112 |
The Algebraic Method for Repeating Decimals
When converting a repeating decimal back to a fraction by hand, the algebraic method is the cleanest approach. Let x equal the repeating decimal, multiply by the appropriate power of 10 to shift the decimal point by one full period, then subtract the two equations to eliminate the repeating tail:
- ›0.(3): Let x = 0.333… → 10x = 3.333… → 10x − x = 3 → 9x = 3 → x = 1/3
- ›0.(142857): Let x = 0.142857142… → 10⁶x = 142857.142857… → 999999x = 142857 → x = 142857/999999 = 1/7
- ›0.1(6): mixed case, separate non-repeating part: x = 0.1666… → 10x = 1.666… → 100x = 16.666… → 90x = 15 → x = 15/90 = 1/6
Practical Applications
- ›Cooking: recipe measurements in cups (¼ = 0.25) converted to millilitres (0.25 × 240 = 60 ml)
- ›Finance: interest rates as fractions vs. decimals for percentage calculations
- ›Engineering: converting imperial fractional dimensions (5/16″) to decimal for CNC programs
- ›Statistics: expressing proportions as decimals for z-score and probability tables
- ›Music theory: beat ratios, dotted note = 3/2 duration = 1.5× the base note
- ›Currency: fractions of cents (3/8 of a cent = $0.00375) in commodity pricing
Precision and Floating-Point Notes
JavaScript uses IEEE 754 double-precision floating-point (64-bit), which stores numbers in binary, not decimal. Some fractions that appear to terminate in decimal (like 0.1 = 1/10) are actually repeating in binary, which is why 0.1 + 0.2 !== 0.3 in most programming languages. This converter uses integer arithmetic for the long division loop, sidestepping floating-point rounding for the repeating block detection, results are exact for all inputs within JavaScript's safe integer range (|n|, |d| < 2⁵³).
Conversion logic runs entirely in your browser using JavaScript integer arithmetic. No input data is transmitted to any server. Repeating block detection uses the Pigeonhole Principle via tracked remainders in long division, capped at 500 digits for performance.
Frequently Asked Questions
How do I know if a fraction will produce a terminating or repeating decimal?
After simplifying the fraction to lowest terms using the GCD, check the prime factorisation of the denominator:
- • If the denominator only has 2s and 5s as prime factors, the decimal terminates, e.g., 8 = 2³, 20 = 2²×5, 40 = 2³×5 all terminate.
- • If the denominator has any other prime factor (3, 7, 11, 13…), the decimal repeats, e.g., 6 = 2×3, 15 = 3×5, 7 are all repeating.
This rule comes directly from the structure of base 10 (= 2×5): only fractions whose denominators divide a power of 10 will terminate in base 10.
What does the period length of a repeating decimal mean?
The period length is the number of digits in the repeating block. For example:
- • 1/3 = 0.(3), period 1 (just the digit 3 repeats forever)
- • 1/7 = 0.(142857), period 6 (the block “142857” repeats)
- • 1/11 = 0.(09), period 2 (the block “09” repeats)
For any fraction 1/p where p is prime and p ≠ 2, 5, the period divides p−1 (by Fermat's little theorem). The period of 1/7 is 6 = 7−1, which is the maximum possible.
How does the decimal-to-fraction conversion work?
For terminating decimals, the process is exact and straightforward:
- • Count the number of decimal places k
- • Write the decimal as an integer over 10ᵏ, e.g., 0.625 → 625/1000
- • Simplify by dividing both by GCD, GCD(625, 1000) = 125 → 5/8
For repeating decimals the algebraic method is used, let x equal the decimal, multiply by 10^(period length), subtract to eliminate the repeating tail, then simplify the resulting integer fraction.
Can all fractions be converted to decimals exactly?
Yes, every rational number (fraction of two integers) can be expressed as either a terminating or eventually repeating decimal. This is a theorem in number theory.
- • Terminating: finite decimal representation, e.g., 3/8 = 0.375
- • Repeating: eventually periodic, e.g., 1/3 = 0.333… The period always ends because there are only finitely many possible remainders (0 through d−1), so by the Pigeonhole Principle a remainder must repeat within d steps.
Irrational numbers (like √2 or π) cannot be expressed as fractions at all, and their decimal expansions are infinite and non-repeating.
What is the difference between 0.999… and 1?
They are equal. 0.(9) = 1 exactly, not approximately, but identically equal. Here's the proof:
- • Let x = 0.999… → 10x = 9.999… → 10x − x = 9 → 9x = 9 → x = 1
- • Alternatively: 1/3 = 0.(3), so 3 × 1/3 = 3 × 0.(3) = 0.(9) = 1
This is a rigorous mathematical fact, not a paradox. The decimal 0.999… represents the limit of the infinite geometric series 9/10 + 9/100 + 9/1000 + … = 9/10 × 1/(1 − 1/10) = 1.
How do I convert a mixed number like 3¼ to a decimal?
Use the Mixed Number → Decimal tab, or do it manually:
- • Convert the mixed number to an improper fraction: 3¼ = (3×4+1)/4 = 13/4
- • Divide: 13 ÷ 4 = 3.25
- • The whole part (3) becomes the integer part of the decimal, and ¼ = 0.25 is added
For negative mixed numbers like −2½: the whole part carries the sign, so −2½ = −(2×2+1)/2 = −5/2 = −2.5. Enter a negative value in the whole-number field.
Why does 0.1 + 0.2 not equal 0.3 in computers?
Computers use IEEE 754 binary floating-point. The decimal 0.1 (= 1/10) cannot be represented exactly in binary because the denominator 10 = 2×5 contains the factor 5, and 5 is not a power of 2.
- • In binary, 0.1 = 0.0(0011), a repeating binary fraction, stored as an approximation
- • The rounding errors from 0.1 and 0.2 do not cancel out when added, so the result differs from the stored approximation of 0.3
- • In JavaScript:
0.1 + 0.2 === 0.30000000000000004
This is why financial software uses fixed-point integer arithmetic (storing cents as integers, not dollars as floats) to avoid rounding surprises.
What is the most decimal places a fraction can have before repeating?
For a fraction n/d in lowest terms, the decimal eventually repeats with a period of at most d − 1 digits.
- • This follows from the Pigeonhole Principle: long division tracks remainders in {0, 1, …, d−1}, so after at most d steps a remainder must reappear
- • For prime denominators p, the maximum period is exactly p−1 (these are called full reptend primes, e.g., 7, 17, 19, 23)
- • 1/97 has period 96, the longest possible for that denominator
Before the decimal repeats there can also be a non-repeating “pre-period” if the denominator has factors of 2 or 5 mixed with other primes, e.g., 1/6 = 0.1(6) where the 1 is the non-repeating part.