All tools

GCD, LCM & Prime Factors

Find the greatest common divisor, least common multiple, prime factorisation, and divisors.

  • gcd
  • lcm
  • prime
  • factorisation
  • divisor
  • factor

About GCD, LCM & Prime Factors

Four classic facts about an integer keep coming up in maths, cryptography, and everyday number puzzles: its prime factorisation (the unique way it splits into prime numbers), its full list of divisors, whether it's prime, and — given two or more integers — the greatest common divisor and the least common multiple of the set.

Prime factorisation tells you the "DNA" of a number. The GCD is what you cancel when reducing fractions; the LCM is the smallest common denominator when adding them. Divisor lists matter for working out factor pairs, schedule overlaps, and aspect ratios. This tool computes all of them for any list of positive integers up to a trillion.

How to use

Type one or more positive integers into the input, separated by commas or spaces (e.g. "24, 36, 60"). For a single number the per-number breakdown is the main thing; for two or more, the GCD and LCM cards at the top become relevant.

Each number gets its own card showing its prime factorisation in compact exponent form (e.g. 2³ × 3 × 5), the full list of divisors, and a "Prime" badge if it has only two divisors (1 and itself). The GCD and LCM cards have copy buttons so you can lift the value directly into a calculator or document. Inputs are capped at 10¹² for fast trial-division factoring.

Frequently asked questions

  • What's the difference between GCD and LCM?

    GCD (greatest common divisor) is the largest number that divides all your inputs evenly. LCM (least common multiple) is the smallest number that's a multiple of all your inputs. For 12 and 18: GCD is 6 (the largest number dividing both), LCM is 36 (the smallest number both divide into).

  • What is a prime number?

    A positive integer greater than 1 that has no divisors other than 1 and itself. 2, 3, 5, 7, 11, 13, 17… The Prime badge appears beside any input that meets this condition. 1 is conventionally not considered prime; 2 is the only even prime.

  • Why does the tool cap at 10¹²?

    Because the prime factorisation uses trial division up to the square root of the input. At 10¹² the worst case requires testing 10⁶ trial divisors, which still runs in a fraction of a second; beyond that the calculation can hang the browser. For larger numbers you'd want a more sophisticated algorithm like Pollard's rho.

  • How is the prime factorisation useful?

    It's the "DNA" of a number — every integer has exactly one prime factorisation. From it you can read off the number of divisors, work out the GCD or LCM with another number, simplify radicals (e.g. √72 = √(2³ × 3²) = 6√2), and reduce fractions to lowest terms.

More Maths tools