GCF & LCM Calculator
Find the GCF and LCM of 2 or more numbers using prime factorization. Step-by-step working with a factor comparison table.
About GCF & LCM Calculator
Find the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of two or more numbers using prime factorisation. Enter up to 10 numbers and see the full factor breakdown with a comparison table showing which primes appear in each number.
What Are GCF and LCM?
| GCF (Greatest Common Factor) | LCM (Least Common Multiple) | |
|---|---|---|
| Definition | The largest number that divides evenly into all given numbers | The smallest number that all given numbers divide into evenly |
| Also called | GCD (Greatest Common Divisor), HCF (Highest Common Factor) | LCD (Least Common Denominator) when used with fractions |
| Example with 12 and 18 | GCF = 6 | LCM = 36 |
| Main use | Simplifying fractions | Adding fractions with different denominators |
How the Prime Factorisation Method Works
The most reliable way to find GCF and LCM is through prime factorisation:
- Break each number into its prime factors
- For GCF: take the lowest power of each prime that appears in ALL numbers
- For LCM: take the highest power of each prime that appears in ANY number
Worked example: Find GCF and LCM of 48 and 180
| Step | 48 | 180 |
|---|---|---|
| Prime factorisation | 2⁴ × 3 | 2² × 3² × 5 |
| GCF (min powers of shared primes) | 2² × 3¹ = 4 × 3 = 12 | |
| LCM (max powers of all primes) | 2⁴ × 3² × 5 = 16 × 9 × 5 = 720 | |
Check: GCF × LCM = 12 × 720 = 8,640 = 48 × 180. This relationship always holds for two numbers.
The GCF-LCM Product Rule
For any two positive integers a and b:
GCF(a, b) × LCM(a, b) = a × b
This means if you know one, you can find the other: LCM(a, b) = (a × b) / GCF(a, b). This shortcut is faster than full prime factorisation for two numbers.
Example: Find LCM(15, 20)
- GCF(15, 20) = 5 (by inspection or Euclidean algorithm)
- LCM = (15 × 20) / 5 = 300 / 5 = 60
Note: this product rule does not extend directly to three or more numbers. For three numbers, you need to compute pairwise: LCM(a, b, c) = LCM(LCM(a, b), c).
Common GCF and LCM Values
| Numbers | GCF | LCM |
|---|---|---|
| 6, 8 | 2 | 24 |
| 12, 18 | 6 | 36 |
| 15, 25 | 5 | 75 |
| 24, 36 | 12 | 72 |
| 14, 21 | 7 | 42 |
| 30, 45 | 15 | 90 |
| 8, 12, 18 | 2 | 72 |
| 6, 10, 15 | 1 | 30 |
The Euclidean Algorithm
For finding the GCF of two numbers without prime factorisation, the Euclidean algorithm is extremely efficient. It works by repeated division:
Worked example: GCF(252, 105)
- 252 ÷ 105 = 2 remainder 42
- 105 ÷ 42 = 2 remainder 21
- 42 ÷ 21 = 2 remainder 0
- The last non-zero remainder is the GCF: 21
This algorithm dates back to Euclid's Elements (around 300 BC) and is one of the oldest algorithms still in practical use today. For a deeper look at breaking numbers into primes, see the prime factorisation tool.
When Do You Need GCF and LCM?
| Task | Which to Use | Example |
|---|---|---|
| Simplify a fraction | GCF | 24/36 - divide both by GCF(24,36) = 12 to get 2/3 |
| Add fractions | LCM | 1/4 + 1/6 - LCD = LCM(4,6) = 12, so 3/12 + 2/12 = 5/12 |
| Divide items into equal groups | GCF | 18 red and 24 blue marbles into identical bags - GCF = 6, so 6 bags |
| Scheduling problems | LCM | Bus A every 12 min, Bus B every 15 min - both arrive together every LCM = 60 min |
| Tiling a floor evenly | GCF | Room 96 × 72 cm with square tiles - largest tile = GCF = 24 cm |
| Gear ratios | LCM | Gears with 12 and 18 teeth mesh perfectly every LCM = 36 teeth of rotation |
GCF of 1 (Coprime Numbers)
When the GCF of two numbers is 1, they are called coprime (or relatively prime). This does not mean both numbers are prime - just that they share no common factor other than 1.
Examples of coprime pairs: (8, 15), (9, 25), (14, 33), (16, 27)
For coprime numbers, the LCM is simply the product: LCM(8, 15) = 8 × 15 = 120.
For fraction arithmetic that uses GCF and LCM automatically, the fraction calculator simplifies and computes with fractions. For dividing numbers and seeing remainders, the long division calculator shows each step.
All calculations run in your browser. No data is sent to any server.
Frequently Asked Questions
What is the difference between GCF and LCM?
GCF (Greatest Common Factor) is the largest number that divides evenly into all given numbers. LCM (Least Common Multiple) is the smallest number that all given numbers divide into evenly.
How many numbers can I enter?
You can enter 2 to 10 positive whole numbers, separated by commas or spaces.
Is GCF the same as GCD and HCF?
Yes. GCF (Greatest Common Factor), GCD (Greatest Common Divisor), and HCF (Highest Common Factor) all mean the same thing - different names used in different countries.
How does the prime factorization method work?
Each number is broken into its prime factors. The GCF takes the lowest power of each prime that appears in all numbers. The LCM takes the highest power of each prime that appears in any number.
What is the relationship between GCF and LCM?
For two numbers a and b, GCF(a,b) times LCM(a,b) equals a times b. This relationship does not extend directly to three or more numbers.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/gcf-lcm-calculator/" title="GCF & LCM Calculator - Free Online Tool">Try GCF & LCM Calculator on ToolboxKit.io</a>