Arithmetic & Numbers
LCM & GCF Calculator
Enter two or more whole numbers separated by commas. The calculator factorises each into primes, then builds the GCF from the shared primes and the LCM from all primes.
- GCF (HCF) = 6
- LCM = 36
Step-by-step working 4 steps
- 1Prime-factorise every number
12 = 2² × 3 18 = 2 × 3²
Break each number into primes.
- 2GCF: take each shared prime at its lowest power
2 × 3 = 6
Only primes that appear in every number count.
- 3LCM: take every prime at its highest power
2² × 3² = 36
Include every prime that appears in any number.
- 4Cross-check
GCF × LCM = 6 × 36 = 216 12 × 18 = 216
For two numbers the product of GCF and LCM always equals the product of the numbers.
How to use the lcm & gcf calculator
- Type your numbers, separated by commas.
- Each number is split into prime factors.
- The GCF takes the lowest power of each shared prime; the LCM takes the highest power of every prime.
- For two numbers, the cross-check line proves the result.
From prime factors
GCF = product of shared primes at their lowest powers LCM = product of all primes at their highest powers GCF(a, b) × LCM(a, b) = a × b
HCF (highest common factor) and GCF (greatest common factor) are two names for the same value.
Worked examples
Each example below is generated by the same calculator you used above, so the working always matches the answer.
12 and 18
- GCF (HCF) = 6
- LCM = 36
Step-by-step working 4 steps
- 1Prime-factorise every number
12 = 2² × 3 18 = 2 × 3²
Break each number into primes.
- 2GCF: take each shared prime at its lowest power
2 × 3 = 6
Only primes that appear in every number count.
- 3LCM: take every prime at its highest power
2² × 3² = 36
Include every prime that appears in any number.
- 4Cross-check
GCF × LCM = 6 × 36 = 216 12 × 18 = 216
For two numbers the product of GCF and LCM always equals the product of the numbers.
12, 18 and 30
- GCF (HCF) = 6
- LCM = 180
Step-by-step working 3 steps
- 1Prime-factorise every number
12 = 2² × 3 18 = 2 × 3² 30 = 2 × 3 × 5
Break each number into primes.
- 2GCF: take each shared prime at its lowest power
2 × 3 = 6
Only primes that appear in every number count.
- 3LCM: take every prime at its highest power
2² × 3² × 5 = 180
Include every prime that appears in any number.
8 and 15
- GCF (HCF) = 1
- LCM = 120
Step-by-step working 4 steps
- 1Prime-factorise every number
8 = 2³ 15 = 3 × 5
Break each number into primes.
- 2GCF: take each shared prime at its lowest power
No shared primes → GCF = 1
Only primes that appear in every number count.
- 3LCM: take every prime at its highest power
2³ × 3 × 5 = 120
Include every prime that appears in any number.
- 4Cross-check
GCF × LCM = 1 × 120 = 120 8 × 15 = 120
For two numbers the product of GCF and LCM always equals the product of the numbers.
48, 180
- GCF (HCF) = 12
- LCM = 720
Step-by-step working 4 steps
- 1Prime-factorise every number
48 = 2⁴ × 3 180 = 2² × 3² × 5
Break each number into primes.
- 2GCF: take each shared prime at its lowest power
2² × 3 = 12
Only primes that appear in every number count.
- 3LCM: take every prime at its highest power
2⁴ × 3² × 5 = 720
Include every prime that appears in any number.
- 4Cross-check
GCF × LCM = 12 × 720 = 8640 48 × 180 = 8640
For two numbers the product of GCF and LCM always equals the product of the numbers.
Common mistakes to avoid
Mixing up LCM and GCF
GCF is never larger than the smallest number; LCM is never smaller than the largest. If your answer breaks that rule, you swapped them.
Multiplying the numbers to get the LCM
a × b is a common multiple but only the least one when the numbers share no factors.
Missing a repeated prime
12 = 2 × 2 × 3, so the prime 2 counts twice. Use exponents to keep track.
Frequently asked questions
When do I use LCM versus GCF?
Use the LCM when events repeat on cycles or when you need a common denominator. Use the GCF when you are splitting into equal groups or simplifying a fraction.
What is the largest number allowed?
Up to one billion per number. Beyond that the factorization is slow in a browser.