Skip to content
M2TOOLKIT

LCM and GCF Calculator

Find the least common multiple and greatest common factor of any set of whole numbers.

  • Free
  • No sign-up
  • Nothing is sent or stored

Result

Greatest common factor (GCF / GCD / HCF)
6
Least common multiple (LCM)
180
How it was calculated
  1. 12 = 2^2 × 3
  2. 18 = 2 × 3^2
  3. 30 = 2 × 3 × 5

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved.

How to use the LCM & GCF Calculator

  1. Enter two or more whole numbers.
  2. Read the GCF and LCM.
  3. Check the prime factorization of each number in the working.

What does this tool do?

The greatest common factor (also called GCD or HCF) is the biggest number that divides all of your numbers exactly. The least common multiple is the smallest number they all divide into.

You use the GCF to simplify fractions and the LCM to find a common denominator when adding fractions.

Why use it?

  • Works with any number of values, not just two.
  • Shows prime factorizations.
  • Uses exact integer arithmetic.

Example: 12, 18 and 30

12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. The GCF takes the lowest shared powers: 2 × 3 = 6. The LCM takes the highest powers of every prime: 2² × 3² × 5 = 180.

The formula

GCF(a, b) by Euclid: GCF(a, b) = GCF(b, a mod b)
LCM(a, b) = |a × b| ÷ GCF(a, b)

Privacy

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the lcm & gcf calculator.