GCD / LCM Calculator

Enter integers to calculate GCD (HCF) and LCM. Supports multiple numbers (comma-separated) and shows Euclidean steps for the first two.

Integers only. Examples: 12,18 · 24, 60, 90 · negatives allowed.

Result will appear here.

Privacy: calculations run locally in your browser. No inputs are stored or transmitted.

How it works

GCD (Euclidean algorithm): repeatedly apply division with remainder until remainder is 0.
LCM: for two numbers, LCM(a,b) = |a×b| ÷ GCD(a,b) (when not both 0).
For multiple numbers, compute pairwise: GCD(a,b,c) = GCD(GCD(a,b),c), similarly for LCM.

Examples

  • 12, 18 → GCD = 6, LCM = 36
  • 24, 60, 90 → GCD = 6, LCM = 360
  • -8, 12 → GCD = 4, LCM = 24
  • 10, 0 → GCD = 10, LCM = 0

FAQ

  • What is GCD (greatest common divisor)?

    GCD is the largest positive integer that divides each number with no remainder. It is also called HCF.

  • What is LCM (least common multiple)?

    LCM is the smallest positive integer that is a multiple of each number.

  • Can I enter more than two numbers?

    Yes. Enter a comma-separated list like 12, 18, 30. The calculator reduces pairwise across the list.

  • Do negative numbers work?

    Yes. GCD and LCM are computed using absolute values. LCM is reported as a positive number.

  • What about zeros?

    GCD(a, 0) = |a|. LCM(a, 0) is 0 by convention. If all inputs are 0, both results are 0.

  • How are GCD and LCM related?

    For two integers a and b (not both 0), |a×b| = GCD(a,b) × LCM(a,b).

Related tools