🔢 Enter Numbers

Enter 2 or more numbers separated by commas or spaces.

Try:

Prime Number Checker

Check if a number is prime and see its factors.

First 50 Prime Numbers

LCM & GCF Formulas

GCF - Euclidean Algorithm

The fastest method to find GCF of two numbers.

GCF(a, b):
while b ≠ 0:
temp = b
b = a mod b
a = temp
return a

Example: GCF(48, 18)
48 mod 18 = 12 GCF(18, 12)
18 mod 12 = 6 GCF(12, 6)
12 mod 6 = 0 GCF = 6

LCM using GCF

LCM(a, b) = |a × b| / GCF(a, b)

Example: LCM(12, 18)
GCF(12, 18) = 6
LCM = (12 × 18) / 6 = 216 / 6 = 36

Prime Factorization Method

GCF = product of COMMON prime factors (lowest powers)
LCM = product of ALL prime factors (highest powers)

Example: 12 = 2² × 3 18 = 2 × 3²

GCF = 2¹ × 3¹ = 6 (min of each power)
LCM = 2² × 3² = 36 (max of each power)

Multiple Numbers LCM/GCF

GCF(a,b,c) = GCF(GCF(a,b), c)
LCM(a,b,c) = LCM(LCM(a,b), c)

Example: GCF(8, 12, 20)
GCF(8,12) = 4, then GCF(4,20) = 4

Real-World Uses

LCM: When do two repeating events coincide?
Bus A every 12 min, Bus B every 18 min
LCM(12,18) = 36 min meet every 36 min

GCF: Largest equal pieces you can cut?
48cm and 18cm ribbons GCF=6 6cm pieces
Fractions: simplify 12/18 divide by GCF(12,18)=6 2/3

Frequently Asked Questions

LCM (Least Common Multiple) is the smallest positive number divisible by all given numbers. Prime factorization method: factorise each number, then take the HIGHEST power of each prime across all numbers and multiply. Example: LCM(12,18). 12 = 2² × 3. 18 = 2 × 3². LCM = 2² × 3² = 4 × 9 = 36. Alternative: LCM(a,b) = (a × b) ÷ GCF(a,b). LCM(12,18) = (12×18) ÷ 6 = 216 ÷ 6 = 36.
GCF (Greatest Common Factor), also called GCD (Greatest Common Divisor) or HCF (Highest Common Factor), is the largest number that divides all given numbers with no remainder. Prime factorization method: take the LOWEST power of each prime common to all numbers. Example: GCF(12,18). 12 = 2² × 3. 18 = 2 × 3². Common primes: 2 (lowest power 2¹) and 3 (lowest power 3¹). GCF = 2 × 3 = 6. Key difference from LCM: GCF is about what they share; LCM is about covering all their factors.
For any two numbers a and b: LCM(a,b) × GCF(a,b) = a × b. This means you only need to find one to calculate the other. LCM(a,b) = (a × b) ÷ GCF(a,b). GCF(a,b) = (a × b) ÷ LCM(a,b). Example: a=12, b=18. GCF=6. LCM = (12×18) ÷ 6 = 36. Verify: 6 × 36 = 216 = 12 × 18 ✓. This relationship only applies to exactly TWO numbers - it doesn't extend directly to three or more.
Two numbers are coprime (relatively prime) if their GCF is 1 - they share no common prime factors. Examples: 8 and 15, 14 and 25, any two consecutive integers. Coprime numbers have a special property: LCM = a × b (since GCF = 1). Fractions a/b where a and b are coprime are already in lowest terms - 7/8 and 11/15 cannot be reduced. Any two prime numbers are always coprime. GCF(n, n+1) = 1 for all positive integers n - consecutive numbers are always coprime.
To simplify a fraction to lowest terms: find GCF of numerator and denominator, then divide both by it. Example: simplify 36/48. GCF(36,48) = 12. 36÷12 = 3, 48÷12 = 4. Simplified: 3/4. The GCF gives the exact factor to divide by - no guessing or trial and error needed. If the GCF is 1, the fraction is already in its simplest form. Repeatedly dividing by any common factor also works eventually, but using the GCF does it in one step.
The Euclidean Algorithm is the most efficient method for GCF: repeatedly replace the larger number with the remainder when divided by the smaller, until the remainder is 0. The last non-zero remainder is the GCF. GCF(48,18): 48 mod 18 = 12. 18 mod 12 = 6. 12 mod 6 = 0. GCF = 6. This works because GCF(a,b) = GCF(b, a mod b). The algorithm is extremely fast - it runs in O(log(min(a,b))) steps - which is why all programming languages and calculators use it for GCF computation.
LCM is used whenever you need to find a common unit or synchronisation point. Adding fractions: to add 1/4 + 1/6, find LCM(4,6) = 12 as the common denominator → 3/12 + 2/12 = 5/12. Scheduling: if Bus A runs every 12 minutes and Bus B every 18 minutes, they meet every LCM(12,18) = 36 minutes. Tiling: tiles of size 4cm and 6cm can line up perfectly every LCM(4,6) = 12cm. Gear ratios: two gears of 8 and 12 teeth return to the same relative position every LCM(8,12) = 24 teeth of movement.
Yes - apply iteratively. GCF(a,b,c) = GCF(GCF(a,b), c). LCM(a,b,c) = LCM(LCM(a,b), c). Example: LCM(4,6,10). Step 1: LCM(4,6) = 12. Step 2: LCM(12,10) = 60. LCM(4,6,10) = 60. Note: the LCM × GCF = a × b relationship does NOT apply to three or more numbers - it only holds for exactly two numbers. This calculator handles any number of inputs using the iterative method automatically.

LCM & GCF Calculator - Least Common Multiple and Greatest Common Factor Explained

LCM and GCF are two of the most frequently used concepts in number theory and everyday arithmetic - from simplifying fractions and adding unlike denominators, to scheduling problems and sharing objects equally into groups. Understanding both numbers and the methods to find them builds mathematical confidence that extends well beyond these two operations.

Key relationship: For any two numbers a and b: LCM(a,b) × GCF(a,b) = a × b. Example: LCM(12,18) = 36 and GCF(12,18) = 6. Check: 36 × 6 = 216 = 12 × 18 . This means if you know any three of the four values (a, b, LCM, GCF), you can always calculate the fourth.

Three Methods to Find LCM and GCF

Prime Factorization Method

  • Factorise each number into primes
  • GCF: take the LOWEST power of each prime common to ALL numbers
  • LCM: take the HIGHEST power of each prime across ANY number
  • Example: 12 = 2² × 3, 18 = 2 × 3²
  • GCF = 2¹ × 3¹ = 6
  • LCM = 2² × 3² = 36
  • Best for showing the relationship visually

Euclidean Algorithm (GCF) & LCM From GCF

  • GCF: divide larger by smaller, replace larger with remainder. Repeat until remainder = 0.
  • GCF(48,18): 48 mod 18 = 12 18 mod 12 = 6 12 mod 6 = 0 GCF = 6
  • Then LCM = (a × b) ÷ GCF = (48 × 18) ÷ 6 = 144
  • Most efficient method for large numbers
  • Used by most programming implementations

Real-World Uses of LCM and GCF

LCM and GCF appear in practical contexts more often than many students realise:

  • Adding fractions with different denominators: To add 1/4 + 1/6, find LCM(4,6) = 12 as the common denominator. Then 3/12 + 2/12 = 5/12. The LCM gives the smallest common denominator, keeping numbers manageable.
  • Simplifying fractions: To simplify 18/24, find GCF(18,24) = 6. Then 18÷6 / 24÷6 = 3/4. GCF gives the exact reduction factor.
  • Scheduling repeating events: If event A happens every 8 days and event B happens every 12 days, they coincide every LCM(8,12) = 24 days.
  • Equal distribution: Dividing 36 apples and 48 oranges into the largest equal groups without remainder: GCF(36,48) = 12. Each group gets 3 apples and 4 oranges.
  • Tile fitting: To tile a floor of 6m × 10m with the largest possible square tiles: GCF(6,10) = 2. Use 2m × 2m tiles.

Coprime Numbers - When GCF = 1

Two numbers are coprime (or relatively prime) if their GCF is 1 - they share no common prime factors. Examples: 8 and 15 (8 = 2³, 15 = 3 × 5 - no shared primes), 14 and 25, 9 and 16.

Coprime numbers have a special property: their LCM equals their product. LCM(8,15) = 8 × 15 = 120 (since GCF = 1, so LCM = a × b ÷ 1 = a × b). Consecutive integers are always coprime - GCF(n, n+1) = 1 for any positive integer n, which is why fractions like 7/8 and 11/12 are already in their simplest form.

LCM and GCF for Three or More Numbers

For three or more numbers, apply the operation iteratively. For GCF: GCF(a,b,c) = GCF(GCF(a,b), c). For LCM: LCM(a,b,c) = LCM(LCM(a,b), c). This is the same principle as the two-number case, applied step by step.

Example: LCM(4,6,10). Step 1: LCM(4,6) = 12. Step 2: LCM(12,10) = 60. So LCM(4,6,10) = 60. Verify: 60 ÷ 4 = 15 , 60 ÷ 6 = 10 , 60 ÷ 10 = 6 . This calculator handles any number of inputs using this iterative approach automatically.

How this calculator works, and where the numbers come from

The LCM & GCF Calculator applies the standard formula for this calculation to the values you enter and updates the result as you type. The calculation itself happens in your browser, and the page explains the method so you can check any result by hand.

Please note: Results are provided for general information and are calculated from the values you enter.

Sources and further reading

Last reviewed: by the CalcQube Editorial Team. See our editorial policy for how we build and check calculators, or report an error.