Free GCF and LCM Calculator

Matrix algebra written in chalk on a green blackboard
Photo: Yulia Meshkova / Wikimedia Commons, CC BY 4.0

Published: 16 November 2026  ·  Updated: 16 November 2026

Find the greatest common factor (GCF) and least common multiple (LCM) of any list of whole numbers, with prime factorization and the Euclidean steps shown. It starts with 12, 18 and 30 (GCF 6, LCM 180). Free, no sign-up.

MixKhazana · Quick answer

GCD comes from the Euclidean algorithm; LCM follows from GCD. Type your numbers separated by commas and read the GCF, the LCM, every prime factorization and the step-by-step working.

Researched by MixKhazana Team · Last updated 16 November 2026 · Data: standard number-theory methods; Maths is Fun reference pages

Separate numbers with commas or spaces. Negative numbers are treated by their absolute value. Whole numbers only, up to 10 digits each.
Example: For 12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. The GCF takes the lowest shared powers (2 × 3 = 6) and the LCM takes the highest powers (2² × 3² × 5 = 180).
Zero and negatives. GCD(0, n) = n, and the LCM of any list containing 0 is 0. Negative numbers use their absolute value: GCD(−12, 18) = 6.

What are GCF and LCM?

The greatest common factor (GCF), also called the greatest common divisor (GCD) or highest common factor (HCF), is the largest whole number that divides every number in your list exactly. The least common multiple (LCM) is the smallest positive number that is a multiple of every number in the list. For 12 and 18, the GCF is 6 and the LCM is 36.

How to use this GCF and LCM calculator

  1. Type two or more whole numbers, separated by commas or spaces.
  2. Read the GCF and LCM instantly, with the prime factorization of every number.
  3. Follow the Euclidean steps to see exactly how the GCD was found — the working your teacher wants to see.

How GCF and LCM are found

  • Euclidean algorithm (GCF): divide the larger number by the smaller, replace the pair with the divisor and the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCD. It is fast even for huge numbers.
  • Prime factorization (both): the GCF takes each shared prime at its lowest power; the LCM takes every prime at its highest power.
  • LCM from GCF: LCM(a, b) = a × b / GCD(a, b). For lists, chain the pairs: LCM(a, b, c) = LCM(LCM(a, b), c).

Worked example

Find the GCF and LCM of 12, 18 and 30:

  • Prime factorization: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5
  • GCF: lowest shared powers = 2¹ × 3¹ = 6
  • LCM: highest powers = 2² × 3² × 5¹ = 4 × 9 × 5 = 180
  • Euclidean check for 18 and 12: 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0, so GCD = 6

Try it above: the default numbers give exactly these results.

GCF and LCM of common pairs

NumbersGCFLCM
8, 12424
12, 18636
15, 25575
7, 13191
24, 36, 6012360

Where GCF and LCM are used

The GCF simplifies fractions (divide top and bottom by the GCF) and factors algebra. The LCM adds fractions with different denominators (the least common denominator), schedules repeating events (two buses every 12 and 18 minutes meet every 36 minutes), and aligns gear teeth, flashing lights and any cycles that must coincide. If two numbers share no factor except 1, they are coprime and their LCM is just their product.

Frequently asked questions

What is the difference between GCF, GCD and HCF?

Nothing: greatest common factor, greatest common divisor and highest common factor are three names for the same number. GCF is common in US schools, HCF in UK schools, and GCD in university mathematics.

How do you find the GCF of two numbers by hand?

Use the Euclidean algorithm: divide the larger by the smaller, then divide the previous divisor by the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF. For 18 and 12: 18 = 12 x 1 + 6, then 12 = 6 x 2 + 0, so the GCF is 6.

How do you find the LCM from the GCF?

Multiply the two numbers and divide by their GCF: LCM(a, b) = a x b / GCF(a, b). For 12 and 18: 216 / 6 = 36. For three or more numbers, chain the pairs.

What is the LCM of 0?

0. Any multiple of 0 is 0, so the least common multiple of a list containing 0 is 0. The GCF with 0 is the other number: GCD(0, n) = n.

Can GCF and LCM handle negative numbers?

Yes, by absolute value: GCD(-12, 18) = 6 and LCM(-12, 18) = 36. Factors and multiples are defined for the size of the number, so the sign is ignored.

What are coprime numbers?

Two numbers whose GCF is 1, such as 7 and 13 or 8 and 15. They share no factor except 1, and their LCM is their product. Consecutive whole numbers are always coprime.

Does this calculator work with decimals?

No. GCF and LCM are defined for whole numbers only. If your problem has decimals, multiply through to clear them first (for example 1.2 and 1.8 become 12 and 18), or use the fraction calculator instead.

What is the largest number this tool handles?

Each input may have up to 10 digits. The Euclidean algorithm itself is fast for far larger numbers, but the prime-factorization display and the LCM can overflow JavaScript's safe-integer range beyond that, so inputs are capped to keep results exact.

Sources

Disclaimer: a study aid for school and everyday mathematics. Results are exact for whole-number inputs within the stated limits.

Related tools

Students studying together with notes and a calculator
➗

Free Fraction Calculator

Add, subtract, multiply and divide fractions with steps.

Open →
Sudoku puzzle in a newspaper
🔢

Free Prime Number Checker

Test any number for primality and factor it.

Open →
Handwritten linear algebra lecture notes with matrices
📐

Free Ratio Calculator

Simplify ratios, scale them and solve proportions.

Open →
Scientific calculator close-up on a green background
🔬

Free Scientific Calculator

Trig, logs and powers with degree and radian modes.

Open →

Card photos: cottonbro studio / Pexels, Pexels licence · Héctor Rodríguez / Wikimedia Commons, CC BY 2.0 · Vyacheslav Argenberg / Wikimedia Commons, CC BY 4.0 · Joost J. Bakker / Wikimedia Commons, CC BY 2.0

Your next step

Check whether your numbers are prime with the Free Prime Number Checker, or use the GCF to simplify fractions with the Free Fraction Calculator.

Share: