GCD + LCM Calculator

GCD LCM MATHEMATICS
Share:

Find the GCD (HCF) and LCM of two or more numbers, with the prime-factorisation method shown step by step. Free, runs in your browser.

RT-MAT-004 · Mathematics

GCD and LCM Calculator

Separate numbers with commas or spaces.

Advertisement
After tool · AD-W1Responsive · Post-tool

How to Use the GCD & LCM Calculator

Enter your numbers

Type two to six whole numbers, separated by commas or spaces — for example 12, 18, 24.

Read the GCD and LCM

The greatest common divisor (also called the highest common factor) and the least common multiple appear instantly, side by side.

See the prime factorisation

Below the answers, each number is broken into its prime factors — the method that explains why the GCD and LCM are what they are.

Apply it

Use the GCD to simplify fractions, or the LCM to find a common denominator or to line up repeating events. Need to simplify a fraction next? The fraction calculator is one click away.

Advertisement
After how-to · AD-W2Responsive

GCD and LCM, Explained

Two Sides of the Same Idea

The greatest common divisor (GCD) — known in many countries as the highest common factor (HCF) — is the largest whole number that divides evenly into a set of numbers. The least common multiple (LCM) is the smallest number that all of them divide into. They sound like opposites, and in a sense they are, but they are really two views of the same underlying structure: the prime factorisation of each number. Every whole number greater than one is a unique product of primes — 12 is 2² × 3, 18 is 2 × 3² — and once you have those factorisations, both answers fall out directly. The GCD takes the lowest power of each prime that appears in every number (here, 2¹ × 3¹ = 6). The LCM takes the highest power of each prime that appears in any number (2² × 3² = 36). This calculator shows that factorisation explicitly, so the GCD and LCM are not magic numbers but visible consequences of how the inputs are built.

These two quantities are quietly everywhere in arithmetic. The GCD is exactly what you use to simplify a fraction: 18/24 reduces to 3/4 because the GCD of 18 and 24 is 6, and dividing top and bottom by 6 gives the lowest-terms form. The LCM is what you need to add fractions with different denominators — it is the least common denominator — and it is also the tool for "when do two cycles line up" problems: two buses leaving every 12 and 18 minutes next depart together after LCM(12, 18) = 36 minutes. This calculator handles up to six numbers at once and uses the same kernel-level GCD routine as the site's fraction calculator, so the value you see here is computed identically to the simplification you would get there.

"GCD and LCM are not two tricks to memorise — they are two readings of one fact: the prime factorisation that every whole number uniquely has."

From the Classroom to Real Cycles

GCD and LCM are a fixture of the secondary-school curriculum precisely because they connect so many ideas: prime factorisation, fractions, divisibility, and even the structure behind modular arithmetic and cryptography later on. Students search for them constantly, often to check homework or to understand the method rather than just the result — which is why this tool leads with the worked factorisation, not just the two answers. Beyond school they show up wherever repeating quantities have to be reconciled: gear ratios in engineering, scheduling events that recur on different intervals, tiling and packing problems, and music, where rhythmic patterns of different lengths realign after their LCM of beats. Because everything runs locally in your browser, it is an instant, private way to both get the answer and see the reasoning, whether you are a student, a parent helping with maths, or a professional who just needs a quick, reliable factorisation.

10 Facts About GCD & LCM

01

The GCD is the largest number that divides all inputs; the LCM is the smallest they all divide into.

02

In many countries the GCD is called the HCF — highest common factor.

03

For two numbers, GCD × LCM = the product of the numbers.

04

The GCD takes the lowest power of each shared prime; the LCM takes the highest.

05

You simplify a fraction by dividing top and bottom by their GCD.

06

The least common denominator for adding fractions is just the LCM of the denominators.

07

The Euclidean algorithm finds the GCD without factorising — over 2,000 years old.

08

If the GCD of two numbers is 1, they are coprime (share no factors).

09

The LCM solves "when do cycles line up" — buses every 12 and 18 min meet at 36.

10

This tool shows the prime factorisation behind both answers.

Frequently Asked Questions

  • The GCD (greatest common divisor) is the largest number that divides evenly into all your numbers; the LCM (least common multiple) is the smallest number that all of them divide into. For 12 and 18, the GCD is 6 and the LCM is 36. This calculator shows both at once, along with the prime factorisation that produces them.
  • Yes — GCD (greatest common divisor) and HCF (highest common factor) are two names for exactly the same thing. Different countries and textbooks use different terms; the calculator labels it "GCD (HCF)" so it is clear whichever you were taught.
  • Factor each number into primes, then for each prime that appears in every number, take its lowest power, and multiply those together. For 12 = 2²×3 and 18 = 2×3², the common primes are 2 and 3, lowest powers 2¹ and 3¹, so the GCD is 2×3 = 6. The calculator shows this factorisation for you.
  • The least common denominator for two fractions is simply the LCM of their denominators. Find it here, rewrite each fraction over that denominator, then add the numerators. Or skip the manual work and use the site's fraction calculator, which does the whole thing and simplifies the result.
  • Yes — up to six numbers at once, separated by commas or spaces. The GCD and LCM are computed across all of them together, and each number's prime factorisation is shown so you can see how the combined answers arise.
  • It means the numbers share no common factor other than 1 — they are "coprime" or "relatively prime". For coprime numbers, the LCM is simply their product, because there is nothing to cancel between them.
  • Yes. The GCD uses the fast Euclidean algorithm, and the factorisation uses efficient trial division, so it comfortably handles the numbers you meet in school and everyday problems, with the prime factorisation shown for each.
  • For two numbers, yes: GCD × LCM equals the product of the two numbers. So once you know one, you can get the other. With three or more numbers this neat identity no longer holds, which is why the calculator computes each properly across the whole set.
  • Yes. Everything is computed in your browser — nothing is uploaded, stored, or logged — and it works offline once loaded. It is private and instant.
  • Completely free, with no account, sign-up, or limit. It runs entirely in your browser and collects no data. Use it as often as you like.

Related News

You may be interested in these recent stories from our newsroom.

No related news yet for this tool. Our editorial team publishes new pieces every week.

Browse all news →
Advertisement
Pre-footer · AD-W3 728 × 90

75 more free tools

Calculators, converters, security tools — no signup.