Tool to find the period of a fraction or a decimal number with repeating decimals. The period is a set of digits that is repeated at infinity in the decimals of the number (usually a rational number or a periodic fraction).
Repeating Decimals - dCode
Tag(s) : Arithmetics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The repeating decimal expansion of a rational number (that is, a fraction $ \frac{p}{q} $ where $ p $ and $ q $ are integers, and $ q \neq 0 $) is a decimal representation in which a sequence of digits repeats infinitely (sometimes called repetend).
Example: $ \frac{1}{3} = 0.\overline{3} = 0.3333\dots $ (the digit 3 repeats indefinitely)
Example: $ \frac{1}{27} = 0.\overline{037} = 0.037037037\dots $ (the sequence 037 repeats indefinitely)
If a rational number does not have a repeating decimal expansion, then it has a finite/terminating decimal expansion.
A finite decimal expansion is a decimal representation that stops after a certain number of digits after the decimal point.
Example: $ \frac{4}{25} = 0.16 $ the expansion is finite and does not continue.
A fraction $ \frac{p}{q} $ has a finite decimal expansion if and only if the denominator $ q $, once simplified, contains in its prime factorization only 2 and/or 5.
Example: $ \frac{1}{8} = 0.125 $ because $ 8 = 2^3 $, but $ \frac{1}{6} = 0.1\overline{6} $ because $ 6 = 2 \times 3 $ (the factor 3 causes the repeating pattern)
The nature of the expansion depends on the denominator of the simplified fraction.
If the prime factors decomposition of the denominator contains only the prime factors 2 and 5, the expansion is finite.
Otherwise, it is periodic.
Several notations exist to represent the repeated part of a repeating decimal expansion:
— With ellipses (non-rigorous notation):
Example: $ \frac{37}{300} = 0.12333333\dots $
— With a bar above (standard notation):
Example: $ \frac{37}{300} = 0.12\overline{3} $
— With a bar below (alternative notation):
Example: $ \frac{37}{300} = 0.12\underline{3} $
-In square brackets (occasional notation):
Example: $ \frac{37}{300} = 0.12[3] $
For clarity, write the fraction in its simplest form before expanding its decimal writing.
Perform the division of the numerator by the denominator. Set up the Euclidean division by hand or use the dCode calculator.
To determine the decimal expansion of a fraction $ \frac{p}{q} $, perform the Euclidean division of the numerator $ p $ by the denominator $ q $.
As soon as a remainder that has already been encountered reappears, the sequence of digits begins to repeat again: the period begins.
Example: $ \frac{1}{7} = 0.142857142857\dots $ (the remainder repeats after 6 steps, so the period is 142857)
Method for converting a repeating decimal $ x $ to a fraction:
— Identify the number of digits $ n $ in the period (the repeating part)
Example: For $ x = 0.1\overline{6} $, the period is $ \overline{6} $, so $ n = 1 $
— Calculate $ 10^n \times x - x $. This subtraction cancels the repeating part, leaving a finite number.
Example: Calculate $ 10x - x = 9x = 1.\overline{6} - 0.1\overline{6} = 1.5 $
— Solve the equation for $ x $
Example: $ x = \frac{1.5}{9} = \frac{15}{90} = \frac{1}{6} $
For an irreducible fraction $ \frac{p}{q} $ whose denominator is not a multiple of 2 or 5, the length of the period is the smallest integer $ n $ such that $ 10^n - 1 $ is divisible by $ q $ (in other words, $ 10^n \equiv 1 \mod{q} $)
Example: For $ \frac{1}{7} $, look for the smallest $ n $ such that $ 10^n - 1 $ is a multiple of 7: $ 10^6 - 1 = 999999 $ is divisible by 7, so the period has 6 digits: $ 142857 $
The inverses of prime numbers provide long and interesting periodic decimal developments.
Example: $ 1/3 = 0.333333\dots $
Example: $ 1/7 = 0.142857142857\dots $
Any rational number (any fraction) has a finite developpement or a periodic decimal expansion with a finite number of digits that repeat themselves ad infinitum.
But there are real numbers that are not rational numbers (which are not fractions) which have decimals without repetition
Example: $ \pi = 3.14159265\dots $ has no known repetition to date.
Example: Champernowne's constant will never have any repetition, it is a universe number.
dCode retains ownership of the "Repeating Decimals" source code. Any algorithm for the "Repeating Decimals" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Repeating Decimals" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Repeating Decimals" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Repeating Decimals" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Repeating Decimals on dCode.fr [online website], retrieved on 2025-11-17,