GCD and LCM calculator
Find the greatest common divisor and least common multiple of two or more integers.
Related tools
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.