LCM & GCD Calculator
Lowest common multiple and greatest common divisor.
Show detailsHide details
Enter two or more whole numbers to find both their greatest common divisor (GCD, also called the HCF) and their lowest common multiple (LCM). The GCD is the biggest number that divides them all; the LCM is the smallest number they all divide into.
Loading calculator...
LCM and GCD — The Quick Answer
The GCD (greatest common divisor, or HCF) is the largest number that divides every value exactly. The LCM (lowest common multiple) is the smallest number every value divides into. They're linked: for two numbers, GCD × LCM = the product of the numbers.
Shortcut
GCD × LCM = a × b → LCM(a, b) = (a × b) ÷ GCD(a, b)
Worked examples
| Numbers | GCD (HCF) | LCM |
|---|---|---|
| 12, 18 | 6 | 36 |
| 8, 12, 20 | 4 | 120 |
| 7, 13 | 1 | 91 |
| 6, 9 | 3 | 18 |
When the GCD is 1 the numbers are 'coprime' — they share no common factor, so their LCM is simply their product (7 and 13 → LCM 91).
How It Works
The Method
Euclidean algorithm and the GCD–LCM relationship
Formula
GCD(a, b): repeat b, a mod b until the remainder is 0 LCM(a, b) = (a × b) ÷ GCD(a, b) For a list: fold GCD and LCM across all numbers
Variables
Greatest common divisor
The largest whole number that divides every value with no remainder. 'HCF' (highest common factor) is the same thing under a different name. Found fast with the Euclidean algorithm, no factoring needed.
Lowest common multiple
The smallest positive number that every value divides into exactly. Most often needed to find a common denominator when adding fractions, or to work out when repeating events line up again.
How they connect
For two numbers, GCD × LCM always equals their product. That's why the LCM can be found by dividing the product by the GCD rather than listing multiples.
Note: For three or more numbers the same identity is applied step by step: take the GCD (or LCM) of the first two, then combine that with the third, and so on.
Worked Example
GCD and LCM of 12 and 18
GCD by the Euclidean algorithm
18 mod 12 = 6, then 12 mod 6 = 0. The last non-zero remainder is 6, so GCD(12, 18) = 6.
LCM from the GCD
LCM = (12 × 18) ÷ 6 = 216 ÷ 6 = 36.
Check
36 ÷ 12 = 3 and 36 ÷ 18 = 2 — both whole, so 36 is a common multiple, and it's the smallest one.
Reference Guide
| unit | value | note |
|---|---|---|
| 12, 18 | GCD 6 · LCM 36 | share a factor of 6 |
| 8, 12, 20 | GCD 4 · LCM 120 | three numbers |
| 7, 13 | GCD 1 · LCM 91 | coprime |
Key Features
Last updated: October 5, 2026

Creators
Computer Scientist & Developer Tools Author
Reviewers
Technical Reviewer
Table of Contents
Quick Facts
Privacy Guaranteed
Your data never leaves your browser. All calculations are 100% private.
Frequently Asked Questions
What is the difference between GCD, HCF, and GCF?
They are three names for exactly the same thing: the greatest common divisor (GCD), highest common factor (HCF), and greatest common factor (GCF) all mean the largest whole number that divides every value in your set with no remainder.
How do you find the LCM of two numbers?
The quickest way is to divide the product of the two numbers by their GCD: LCM = (a × b) ÷ GCD. For 12 and 18, that's (12 × 18) ÷ 6 = 36. This is faster and less error-prone than listing out multiples until you find a match.
What does it mean if the GCD is 1?
The numbers are 'coprime' (relatively prime) — they share no common factor other than 1. In that case their LCM is simply their product. For example 7 and 13 are coprime, so their LCM is 7 × 13 = 91.
When do I actually need the LCM or GCD?
The LCM is used to find a common denominator when adding or subtracting fractions, and to work out when repeating cycles coincide (e.g. two buses leaving every 12 and 18 minutes next depart together after 36 minutes). The GCD is used to simplify fractions and ratios to lowest terms.