GCD & LCM Calculator
Find the greatest common divisor and least common multiple of two numbers.
Enter two whole numbers to get their greatest common divisor (GCD) and least common multiple (LCM). Useful for simplifying fractions, finding common denominators and number-theory homework.
Formula / method
Examples
GCD 6, LCM 36
GCD 4, LCM 24
Divisor and multiple, defined
The greatest common divisor (GCD) is the largest whole number that divides both inputs with no remainder, while the least common multiple (LCM) is the smallest number both divide into evenly. They are linked by a neat identity: for any two positive integers, GCD times LCM equals the product of the numbers, so this tool finds the GCD first (using the fast Euclidean algorithm) and derives the LCM from it.
If two numbers share no common factor other than 1, their GCD is 1 and they are called coprime; their LCM is then simply the two multiplied together.
Where it comes up
GCD is the engine behind reducing fractions to lowest terms, so it pairs naturally with the fraction simplifier on UtilGears. LCM is what you need to find a common denominator when adding fractions, or to work out when two repeating events line up, such as buses that leave every 12 and every 18 minutes.
Enter positive whole numbers; decimals and negatives are outside the usual definition. Order does not matter, since both results are the same whichever number you type first.
Where it's used
- Reducing a fraction to its lowest terms by dividing by the GCD
- Finding a common denominator to add or compare fractions using the LCM
- Working out when two repeating cycles line up again
- Number-theory and discrete-math homework
- Simplifying ratios and aspect ratios
Real-world examples
- 12 and 18 share a GCD of 6 and an LCM of 36.
- To add 1/8 and 1/12, the LCM of 8 and 12 (24) gives the common denominator.
- Buses leaving every 12 and every 18 minutes next depart together after 36 minutes — their LCM.
- 8 and 15 are coprime (GCD 1), so their LCM is simply 8 × 15 = 120.
A bit of history
This calculator finds the GCD with the Euclidean algorithm, described by the Greek mathematician Euclid in his Elements around 300 BC. It is one of the oldest algorithms still in everyday use.
Did you know?
The method used here to find the GCD — Euclid's algorithm from about 300 BC — is often cited as the oldest non-trivial algorithm still running inside modern computers.
FAQ
What are GCD and LCM used for?
GCD simplifies fractions and ratios; LCM finds common denominators and lines up repeating cycles.