Skip to content
TextArray
100% local

GCD and LCM calculator

Find the greatest common divisor and least common multiple of two or more integers.

Input
Output

GCD and LCM calculator

Paste two or more whole numbers and get their greatest common divisor (GCD) and least common multiple (LCM) in one step. Values can be separated by spaces, commas, semicolons or new lines, so a column copied from a spreadsheet works as well as a quick "12, 18, 24" typed by hand. The math runs on exact big-integer arithmetic, so results stay correct far beyond what a pocket calculator or a floating-point script can handle.

The GCD is the number you divide by to reduce a fraction to lowest terms, and the LCM is the common denominator you need to add fractions — which makes this the fastest way to check homework or prepare exercises. The same two numbers answer practical questions too: how many teeth two gears turn through before they line up again, when two repeating schedules coincide, or into how many equal groups two quantities can be split without leftovers.

Keep "Show prime factorizations" on and the tool shows its work the way it is taught in school: each input decomposed into primes, then the GCD assembled from the lowest shared powers and the LCM from the highest power of each prime. Factorization is skipped for inputs of 10¹² or more, where trial division would take too long; the GCD and LCM themselves stay exact. Switch on "Show divisors of the GCD" to list every common divisor of your numbers whenever the GCD is below 1,000,000.

Everything is computed in your browser and nothing is uploaded, so your numbers never leave your device. The tally under the output updates live as you type.

FAQ

What are the GCD and LCM used for?
The GCD reduces a fraction to lowest terms and splits quantities into the largest possible equal groups. The LCM gives the common denominator for adding fractions and tells you when repeating cycles — gear teeth, bus schedules, shift rotations — line up again.
How large can the numbers be?
The GCD and LCM are computed with exact big-integer arithmetic, so numbers with hundreds of digits work. Prime factorizations are only shown for inputs below 10¹², where they can be found quickly, and the LCM is capped at 100,000 digits.
What happens with negative numbers or zero?
Negative values are taken as absolute values and the report says so. Zero is fine alongside other numbers — the GCD ignores it and the LCM becomes 0 — but a list of only zeros has no defined result, so the tool asks for a non-zero integer.
Are my numbers uploaded anywhere?
No. Every calculation runs in your browser and the numbers never leave your device.