Skip to main content

Free LCM & GCD Calculator – Least Common Multiple and HCF

LCM and GCD Calculator finds the least common multiple and greatest common divisor of two numbers online for free with instant results.

Written & reviewed by Helperzy Editorial Team · Updated July 2026

LCMGCD / HCFEuclideanInstantFree

GCD (HCF)

6

LCM

144

100% Private

Runs locally. Nothing uploaded.

How to Use LCM & GCD Calculator

1

Enter First Number

Type the first whole number into the field. The tool uses its absolute value, so a negative sign will not trip it up. Blank or non-whole entries return a neutral placeholder rather than a wrong answer.

2

Enter Second Number

Type the second whole number to compare with the first. The Euclidean algorithm works on the pair to find the GCD, and the LCM follows from it. There is no button to press — results appear as you type.

3

View LCM and GCD

Both results appear instantly side by side as you finish typing. Use the GCD to simplify a fraction and the LCM as a common denominator for addition. Change either number to recalculate on the spot.

Find the GCD and LCM of Two Numbers Together

The Helperzy LCM and GCD Calculator finds both the greatest common divisor and the least common multiple of two whole numbers at the same time, displayed side by side. The greatest common divisor — also called the highest common factor (HCF) or greatest common factor (GCF) — is the largest number that divides both values evenly without leaving a remainder. The least common multiple is the smallest positive number that both values divide into cleanly. Enter two numbers and both answers appear at once, which saves you the tedious textbook work of listing every factor or enumerating multiples by hand until a match appears. These two values are among the most commonly needed results in basic number theory and fraction arithmetic. The tool computes the GCD with the Euclidean algorithm, a method over two thousand years old and still the fastest known for the job. In words: you repeatedly replace the larger number with the remainder of dividing the two numbers, and you keep going until the remainder hits zero; the last non-zero value you held is the GCD. Once the GCD is known, the LCM follows from a tidy algebraic identity: LCM(a, b) = (a × b) ÷ GCD(a, b). Because that relationship is exact and avoids enumeration, the calculator never has to list multiples one by one, so it stays quick even for large inputs that would take dozens of lines to work out on paper. The algorithm's time complexity is logarithmic relative to the smaller number, making it efficient even for values in the millions. Here is a worked example with 12 and 18. Divide 18 by 12: quotient 1, remainder 6. Now divide 12 by 6: quotient 2, remainder 0 — stop. The last non-zero remainder is 6, so GCD(12, 18) = 6. The LCM is then (12 × 18) ÷ 6 = 216 ÷ 6 = 36. You can verify both results: 6 is indeed the largest number dividing both 12 and 18 (12 ÷ 6 = 2, 18 ÷ 6 = 3), and 36 is the smallest number that both 12 and 18 divide into (36 ÷ 12 = 3, 36 ÷ 18 = 2). Try another pair: for 8 and 12, 12 mod 8 = 4, then 8 mod 4 = 0, so the GCD is 4, and the LCM = (8 × 12) ÷ 4 = 24. Results appear the instant you finish typing. These two quantities turn up constantly in everyday math and beyond. The GCD reduces a fraction to lowest terms — dividing numerator and denominator of 12/18 by their GCD of 6 gives the simplified form 2/3. The LCM gives you the common denominator when adding or subtracting fractions with different denominators, for example 1/4 + 1/6 requires a denominator of 12. Beyond arithmetic, they solve scheduling puzzles (when two buses with different intervals next depart together), gear-ratio problems in mechanical engineering, tiling and packing questions where piece sizes must fit without gaps, and music theory where beat cycles of different lengths align into a repeating pattern. A few notes on behaviour and edge cases. The tool works with whole numbers and uses their absolute value, so negative signs do not cause confusion or incorrect output. The GCD of any number with zero is that number itself, since every number divides zero evenly, and the LCM involving zero is defined as zero — both cases are handled gracefully with correct output rather than an error. A blank or non-whole input yields a neutral placeholder rather than a wrong answer. Everything is computed in your browser with no network request, so your numbers are never uploaded or stored anywhere, and the result appears without any round-trip delay to a server.

LCM & GCD Calculator Formula & Method

GCD via Euclidean algorithm: repeatedly take a mod b until 0; LCM = (a × b) ÷ GCD(a, b)

Examples: LCM & GCD Calculator

Input

12 and 18

Result

GCD = 6, LCM = 36

18 mod 12 = 6, 12 mod 6 = 0 → GCD 6; (12×18)÷6 = 36.

Input

8 and 12

Result

GCD = 4, LCM = 24

GCD is 4; (8 × 12) ÷ 4 = 24.

Frequently Asked Questions – LCM & GCD Calculator

Enter two whole numbers into the Helperzy LCM and GCD Calculator and both the least common multiple and the greatest common divisor appear instantly. There is no button to press. All calculation runs in your browser, so your numbers stay private and are never uploaded.