GCF & LCM Calculator (Free Step-by-Step Tool)
Fractions & numbersFreeNo sign-up
A GCF and LCM calculator finds the greatest common factor and the least common multiple of whole numbers. For 24 and 36, write each number as primes: 24 = 2³ × 3 and 36 = 2² × 3². The GCF uses the lowest powers, 2² × 3 = 12. The LCM uses the highest powers, 2³ × 3² = 72. Check: 12 × 72 = 864 = 24 × 36.
GCF(24, 36)
LCM(24, 36)
The GCF of 24 and 36 is 12, the largest number that divides both. The LCM is 72, the smallest number both divide into.
Show steps: 4 methods
- Break each number into primes. Divide by the smallest prime that goes in, then repeat with the quotient until only primes are left. The circled numbers at the ends of the branches in each factor tree are the prime factors.
- GCF: take only the primes that appear in every number, each with its lowest power: 2² × 3 = 12.
- LCM: take every prime that appears in any number, each with its highest power: 2³ × 3² = 72.
| Prime | 24 | 36 | GCF: lowest | LCM: highest |
|---|---|---|---|---|
| 2 | 2³ | 2² | 2² | 2³ |
| 3 | 3 | 3² | 3 | 3² |
| Product | 24 | 36 | 12 | 72 |
- List all the factors of each number. Factors shared by every number are in green; the greatest one is highlighted.24: 1, 2, 3, 4, 6, 8, 12, 2436: 1, 2, 3, 4, 6, 9, 12, 18, 36
- Common factors: 1, 2, 3, 4, 6, 12. The greatest is 12, so GCF = 12.
- List multiples of each number until you reach a number that is in every list. That first shared multiple is the LCM.24: 24, 48, 7236: 36, 72
- The smallest number in every list is 72, so LCM = 72.
- Divide the larger number by the smaller one and keep the remainder. Then divide the old divisor by that remainder. Repeat until the remainder is 0. The last divisor (the last nonzero remainder) is the GCF.
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 36 = 1 × 24 + 12 | 1 | 12 |
| 2 | 24 = 2 × 12 + 0 | 2 | 0 |
- GCF = 12.
- For the LCM, use LCM(a, b) = a × b ÷ GCF(a, b):LCM(24, 36) = 24 × 36 ÷ 12 = 72So LCM = 72.
| 2 | 24 | 36 |
| 2 | 12 | 18 |
| 3 | 6 | 9 |
| 2 | 3 |
- Write the numbers in a row. Divide them all by a prime that goes into every one of them, and write the quotients underneath. Keep going until no prime divides all of them.
- GCF = the primes down the left side (the green ones): 2 × 2 × 3 = 12.
- LCM = every divisor on the left × every number on the bottom row: 2 × 2 × 3 × 2 × 3 = 72.
How to use the GCF and LCM calculator
- Type 2 to 10 whole numbers in the box, separated by commas or spaces (for example 12, 18, 30). The answer updates as you type.
- Read the GCF and LCM at the top, then each number’s prime factors and, for two numbers, the GCF × LCM check.
- Open Show steps and switch between the four methods: prime factors (with factor trees, a Venn diagram and an exponent table), listing factors and multiples, the Euclidean algorithm, and the ladder (cake) method.
- For story problems, use the Word problems tab: equal groups and square tiles (GCF) or “together again” schedules (LCM).
GCF vs. LCM: what each one means
The greatest common factor (GCF) is the largest number that divides every number in the list with no remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF).
The least common multiple (LCM) is the smallest positive number that every number in the list divides into. The least common denominator of two fractions is the LCM of their denominators.
| GCF | LCM | |
|---|---|---|
| Question it answers | Largest number that goes into all of them | Smallest number all of them go into |
| Size | At most the smallest number | At least the largest number |
| Prime factors | Shared primes, lowest powers | All primes, highest powers |
| Example: 12 and 18 | 6 | 36 |
| Typical use | Simplifying fractions, equal groups | Common denominators, repeating schedules |
Four ways to find the GCF and LCM
1. Listing factors and multiples
List every factor of each number and pick the largest one they share. Then list multiples until one shows up in every list. For 12 and 18: the factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18, so the GCF is 6. The multiples of 12 are 12, 24, 36 and the multiples of 18 are 18, 36, so the LCM is 36. It is clear for small numbers but slow for big ones.
2. Prime factorization (factor trees and Venn diagram)
Break each number into primes with a factor tree. GCF = the primes every number shares, each with its lowest power. LCM = every prime that appears, each with its highest power. In a Venn diagram, shared primes go in the overlap: the GCF is the product of the overlap and the LCM is the product of everything in the diagram.
3. The Euclidean algorithm
Divide the larger number by the smaller one, then divide the old divisor by the remainder, until the remainder is 0. The last nonzero remainder is the GCF. It needs no factoring, so it is fastest for large numbers. Then LCM(a, b) = a × b ÷ GCF(a, b).
4. The ladder (cake) method
Write the numbers in a row and divide them all by a prime that goes into every one, writing the quotients underneath. When no prime divides all of them, the GCF is the product of the divisors on the left. For the LCM, keep dividing by any prime that goes into at least two numbers (bring the others down), then multiply the left column by the bottom row.
Worked examples
Example 1: GCF and LCM of 12, 18 and 30
12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. The primes in all three are 2 and 3, each at least to the first power, so the GCF is 2 × 3 = 6. For the LCM, take 2², 3² and 5: 4 × 9 × 5 = 180. Note that 6 × 180 = 1,080 is not 12 × 18 × 30 = 6,480: the product rule only works for two numbers.
Example 2: Euclidean algorithm for 1071 and 462
1071 = 2 × 462 + 147. Then 462 = 3 × 147 + 21. Then 147 = 7 × 21 + 0. The remainder is 0, so the GCF is 21. The LCM is 1071 × 462 ÷ 21 = 23,562.
Example 3: the ladder for 48, 180, 300 and 420
Divide all four by 2 (24, 90, 150, 210), by 2 again (12, 45, 75, 105) and by 3 (4, 15, 25, 35). No prime divides all four now, so the GCF is 2 × 2 × 3 = 12. Next, 5 divides 15, 25 and 35 but not 4, so 4 comes down unchanged: 4, 3, 5, 7. The LCM is 2 × 2 × 3 × 5 × 4 × 3 × 5 × 7 = 25,200.
The GCF × LCM shortcut for two numbers
For any two positive whole numbers, GCF(a, b) × LCM(a, b) = a × b. So once you know the GCF, LCM = a × b ÷ GCF. For 24 and 36: 24 × 36 = 864, and 864 ÷ 12 = 72. It works because the GCF takes the lower power of each prime and the LCM the higher one, so together they use every prime factor exactly once. It does not hold for three or more numbers.
GCF or LCM? Telling word problems apart
- Use the GCF when you split things into the largest possible equal groups, cut pieces as long as possible, or pick the largest square tile. Example: 18 red roses, 27 white roses and 45 tulips make at most 9 identical bouquets, each with 2 red roses, 3 white roses and 5 tulips.
- Use the LCM when things repeat on different cycles and you want the next time they line up. Example: if Bus A leaves every 12 minutes and Bus B every 18 minutes, they leave together again after 36 minutes, after 3 trips of Bus A and 2 of Bus B.
A quick test: if the answer must be smaller than the numbers you start with, it is a GCF problem. If it must be larger, it is an LCM problem. A 60 by 84 inch wall, for example, can be covered with 12 inch square tiles, 5 × 7 = 35 of them, because GCF(60, 84) = 12.
GCF and LCM quick reference table
| Numbers | GCF | LCM |
|---|---|---|
| 6 and 8 | 2 | 24 |
| 7 and 9 | 1 | 63 |
| 8 and 12 | 4 | 24 |
| 9 and 12 | 3 | 36 |
| 10 and 15 | 5 | 30 |
| 12 and 18 | 6 | 36 |
| 14 and 21 | 7 | 42 |
| 15 and 20 | 5 | 60 |
| 16 and 24 | 8 | 48 |
| 18 and 24 | 6 | 72 |
| 20 and 30 | 10 | 60 |
| 24 and 36 | 12 | 72 |
Common mistakes to avoid
- Mixing up the powers. The GCF takes the lowest power of each shared prime and the LCM takes the highest. Swapping them gives 2³ × 3² = 72 as the “GCF” of 24 and 36.
- Leaving out a prime in the LCM. Every prime that appears in any number belongs in the LCM, even if only one number has it (the 5 in 12, 18, 30).
- Multiplying the numbers to get the LCM. 12 × 18 = 216 is a common multiple, but the least one is 36. Multiplying only gives the LCM when the GCF is 1.
- Using the product rule for three numbers. GCF × LCM = a × b is a two-number rule only.
Using the calculator for homework
Work the problem by hand first, then type the same numbers in and compare. If your answer differs, open the steps for the method your teacher uses and find the first line that does not match yours. A quick accuracy check: the GCF must divide the smallest number, and the LCM must be a multiple of the largest.
GCF and LCM practice quiz: 10 questions
Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.
16 = 2⁴ and 40 = 2³ × 5. The shared prime is 2, with lowest power 2³ = 8. 80 is the LCM, not the GCF.
6 = 2 × 3 and 10 = 2 × 5. Take every prime with its highest power: 2 × 3 × 5 = 30. Multiplying 6 × 10 = 60 gives a common multiple, but not the least one.
18 = 2 × 3², 24 = 2³ × 3, 42 = 2 × 3 × 7. The primes in all three are 2 and 3 (each to the first power), so the GCF is 6.
4 = 2², 6 = 2 × 3, 9 = 3². Highest powers: 2² × 3² = 36. 216 is the product of all three numbers.
For two numbers, GCF × LCM = product, so LCM = 432 ÷ 6 = 72. Check with 18 and 24: GCF 6, LCM 72, product 432.
252 = 2 × 105 + 42, then 105 = 2 × 42 + 21, then 42 = 2 × 21 + 0. The last nonzero remainder, 21, is the GCF.
15 = 3 × 5 and 28 = 2² × 7 share no prime, so their GCF is 1. Neither number has to be prime to be coprime.
The number of kits must divide both 32 and 48, and we want the largest, so it is GCF(32, 48) = 16. Each kit gets 2 markers and 3 crayons.
The next shared time is the LCM: 8 = 2³ and 12 = 2² × 3, so LCM = 2³ × 3 = 24 seconds. 96 = 8 × 12 is also a shared time, but not the first.
Only primes in both numbers count, each with its lowest power: 2¹ and 5¹. The prime 3 is only in b, so it belongs in the LCM, not the GCF.
Quiz complete
Frequently asked questions
How do you find the GCF using prime factorization?
Write each number as a product of primes, circle the primes that appear in every number, and multiply them using the lowest power of each. For 24 = 2³ × 3 and 36 = 2² × 3², the shared primes are 2² and 3, so the GCF is 4 × 3 = 12.
How do you find the LCM?
Take every prime that appears in any of the numbers, use its highest power, and multiply. For two numbers you can also divide their product by the GCF: LCM(24, 36) = 864 ÷ 12 = 72.
Can the calculator handle more than two numbers?
Yes. It takes 2 to 10 whole numbers, each up to 30 digits long. For numbers above 1,000,000,000,000 it skips factoring and uses the Euclidean algorithm, which works at any size.
What is the GCF of two prime numbers?
Two different primes share no factor except 1, so their GCF is 1 and their LCM is their product. For 7 and 11 the LCM is 77. Numbers with a GCF of 1, such as 8 and 9, are called relatively prime or coprime, even when neither is prime.
What is the GCF of 0 and a number?
Every whole number divides 0, so GCF(0, n) = n. For example, GCF(0, 15) = 15. The LCM of 0 and any number is taken as 0, and GCF(0, 0) is not defined.
Related calculators
- Prime factorization calculator
- Simplify fractions calculator
- Least common denominator calculator
- Fraction calculator
More fractions & numbers calculators
Related to This Article
More math articles
- Full-Length ASVAB Math Practice Test-Answers and Explanations
- FREE 4th Grade MEAP Math Practice Test
- Rumors, Fads, Fashions, and Mass Behavior
- Idaho ISAT Grade 6 Math Free Worksheets: 72 Free PDF Worksheets, One Skill at a Time
- Organizations, Control, and the Experience of Work
- Top 10 Free Websites for SAT Math Preparation
- Unfunded mandates
- Integer Operations Practice — Add, Subtract, Multiply & Divide
- 6th Grade Georgia Milestones Assessment System Math Worksheets: FREE & Printable
- How to Order Integers and Numbers? (+FREE Worksheet!)









What people say about "GCF Calculator (and LCM): Step-by-Step, 4 Methods"?
No one replied yet.