A rational or irrational calculator tells you which kind a number is, and why. Type a fraction and it shows whether its decimal terminates or repeats. Type a decimal, with repeating digits in brackets, and it finds the exact fraction. Type a whole number and it tells you whether its square root is rational. It also explains why π, e and √2 are irrational. It is useful for homework and for seeing how fractions and decimals are linked, and it runs in your browser.
How to use the rational or irrational calculator
- Choose A fraction, A decimal, A square root or A famous constant.
- Type the number.
- Press Check and read the verdict and the reason.
Rational and irrational numbers
The Wikipedia article on rational numbers defines a rational number as one that can be expressed as the quotient or fraction p ÷ q of two integers, with a nonzero denominator q.[2] The article on irrational numbers says that irrational numbers are those that cannot be expressed as the ratio of two integers, so a real number that is not rational is irrational.[1] The numbers 3/4, −2 and 0.5 are rational. The number √2 is not, and neither are π and e, which the pages list among the irrational numbers.[1]
What the decimal tells you
The rational number page states that the real numbers that are rational are those whose decimal expansion either terminates after a finite number of digits, as in 3/4 = 0.75, or eventually begins to repeat the same finite sequence of digits over and over, as in 9/44 = 0.20454545….[2] The page on repeating decimals puts it as a number being rational if and only if its decimal representation is repeating or terminating.[3] The irrational number page adds that the decimal of an irrational number does not terminate or end with a repeating sequence.[1] The calculator uses the rule in the first direction: you give it a fraction, and it tells you which of the two forms the decimal takes, and for a repeating decimal the length of the repeating block.
Which fractions terminate
The repeating decimal page gives the rule: in base 10, a fraction has a repeating decimal if and only if, in lowest terms, its denominator has at least one prime factor other than 2 and 5, in other words if the denominator cannot be written as 2ᵐ5ⁿ.[3] So 3/8 terminates because 8 = 2³, and 0.375 is its decimal. The page's example of a terminating decimal is 1.585 = 317 ÷ (2³ × 5²).[3] But 1/3 repeats, because 3 is not 2 or 5. The calculator reduces the fraction first, and then it checks the denominator. For 6/8 it reduces to 3/4, whose denominator is 2², so it terminates. The repeating block is found from the order of 10 modulo the part of the denominator that is left after the 2s and 5s are removed.
Examples of repeating decimals
The page says that the decimal for 1/3 becomes periodic just after the decimal point, with the single digit 3 repeating forever, so 1/3 = 0.333… with a block length of 1.[3] It gives 1/7 = 0.142857, with six repeating digits, and 5/74 = 0.0675675…, whose block is 675, and 3227/555 = 5.8144144….[3] The calculator writes the repeating block in brackets, so 1/7 appears as 0.(142857) and 5/74 as 0.0(675). The block of 9/44 is 45 after the digit 0 and a 2, which the calculator writes as 0.20(45).
From a repeating decimal to a fraction
The decimal mode goes the other way. Write the repeating digits in brackets, as in 0.(3), 0.1(6) or 2.0(45). The calculator turns the number into an exact fraction. The idea is to subtract the number with the repeating part removed from the number with one block moved before the point. For 0.(3), the result is 1/3. For 0.1(6), it is 1/6. For 0.(9), the answer is exactly 1, which surprises many people but is correct. A finite decimal such as 2.5 is also a fraction, here 5/2, and the calculator reports that every decimal that stops is rational.
Square roots
The article on irrational numbers says that all square roots of natural numbers, other than of perfect squares, are irrational.[1] So √16 = 4 is rational, but √2, √3 and √8 are irrational. It gives the proof by Hippasus for the number 2: assume that c and b are coprime integers with c² = 2b². Then c is even, and so b is even too, which contradicts the assumption that they have no common factor.[1] The calculator checks whether your whole number is a perfect square with exact arithmetic. If it is not, it shows an approximate value, and if the root can be simplified, it gives the simplified form, such as √8 = 2√2, which is still irrational.
Famous irrational numbers
The numbers π, the ratio of a circle's circumference to its diameter, and e, Euler's number, are both on the page's list of irrational numbers.[1] The famous constants mode shows the first digits of each and states the reason. Their decimals never terminate and never settle into a repeating pattern. You can compute as many digits as you like, but no finite number of digits, and no fraction, is exactly equal to them.
Common mistakes
- Thinking that a long decimal must be irrational. A decimal like 1/7 repeats after six digits.
- Forgetting to reduce the fraction. 6/8 is 3/4, and it terminates.
- Calling √16 irrational. It is 4, which is rational.
- Writing a repeating decimal without brackets. The calculator needs to know which digits repeat.
What next
Use this often? Add Rational or to your Home screen.
Frequently asked questions
What is a rational or irrational calculator?
A tool that tells you whether a number is a ratio of whole numbers, shows if a fraction's decimal terminates or repeats, and turns repeating decimals into fractions.
How can I tell if a fraction terminates?
Reduce it to lowest terms. It terminates only if the denominator has no prime factors except 2 and 5.
Is 0.333... rational?
Yes. It repeats, and it equals 1/3. Any repeating or terminating decimal is rational.
Is √8 rational?
No. 8 is not a perfect square, so its square root is irrational. It simplifies to 2√2.
Are π and e rational?
No. Both are irrational. Their decimals never end or repeat, and no fraction equals them exactly.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.