GCD & LCM Calculator
Greatest common divisor and least common multiple

GCD & LCM Calculator is a free online calculator that helps you greatest common divisor and least common multiple. Fill in First Number and Second Number and read your answer immediately. The result comes with a step-by-step breakdown — no black box, just math you can check. Great when you want certainty fast — no formulas to memorize, no apps to install. Your inputs never leave your device: the calculation is fully client-side, and optional analytics/advertising only activate with your consent. Searching for gcd lcm calculator greatest common divisor least common multiple or free online gcd & lcm calculator? This tool covers it — free, fast, and private. Bookmark it and the answer is always one click away.
What does the page calculator do?
GCD & LCM Calculator works out the gcd from the First Number and Second Number, following standard Utilities conventions — the page defaults produce a gcd of 6 | LCM: 36.
- Inputs: First Number and Second Number.
- Output: the gcd, plus the intermediate steps behind it.
- Method: the standard Utilities formula, evaluated entirely in your browser.
Quick answer
With the default inputs (first number of 12, second number of 18), gcd & lcm calculator returns a gcd of 6 | LCM: 36. Assumptions and limits are summarized below.
How does it work?
GCD & LCM Calculator computes the gcd directly from your inputs — the First Number and Second Number feed the formula. Nothing is uploaded: the math runs locally in your browser and the result appears as you type.
What This Calculator Really Does
The greatest common divisor (GCD) is the largest number that divides two integers exactly; the least common multiple (LCM) is the smallest number they both divide into. This calculator runs the Euclidean algorithm for the GCD — showing each remainder step — and applies the identity GCD × LCM = a × b for the LCM.
The Euclidean algorithm is one of the oldest efficient procedures in mathematics, and it is still the right one: instead of factoring, it replaces the pair (a, b) with (b, a mod b) until the remainder hits zero. Three or four steps solve numbers whose prime factorization would take a page.
Everything runs locally in your browser: no numbers stored, nothing tracked, offline after the first visit.
Quick answer: gcd(48, 180) = 12 (remainders 36 → 12 → 0), and lcm(48, 180) = 48 × 180 ÷ 12 = 720.
The Method, Explained Plainly
Euclidean algorithm: repeatedly replace (a, b) with (b, a mod b) until b = 0; the last nonzero a is the GCD.
LCM identity: LCM(a, b) = (a × b) ÷ GCD(a, b)
- Why it works — every common divisor of a and b also divides a mod b, so the GCD is preserved by each replacement step.
- Why the identity holds — a × b counts the shared prime factors (GCD) twice and the unshared ones once; dividing by GCD leaves exactly the LCM.
For more than two numbers, fold pairwise: gcd(gcd(a, b), c), lcm(lcm(a, b), c).
How to Use It — In Order
- Enter two positive integers — order does not matter; the algorithm is symmetric in effect.
- Read the GCD — with the full remainder chain shown for verification.
- Read the LCM — computed via the identity, no factoring needed.
- Add more numbers — for several, the tool folds pairwise; check the running GCD only shrinks and the LCM only grows.
- Use it on fractions — GCD reduces a fraction to lowest terms; LCM is the common denominator for adding them.
- Sanity-check — the GCD must divide both inputs exactly; a quick division confirms it.
Worked Example, Verified by Hand
GCD(48, 180) by the Euclidean algorithm:
- 180 mod 48 = 36 (48 × 3 = 144, remainder 36).
- 48 mod 36 = 12.
- 36 mod 12 = 0 → stop. Last nonzero value: GCD = 12.
- LCM = 48 × 180 ÷ 12 = 8,640 ÷ 12 = 720.
Checks: 12 divides both (48 ÷ 12 = 4; 180 ÷ 12 = 15) ✓. 720 is a multiple of both (720 ÷ 48 = 15; 720 ÷ 180 = 4) ✓. Fraction reduction in action: 48/180 = 4/15 after dividing by the GCD.
Common Mistakes to Avoid
- Factoring instead of using the algorithm — the Euclidean method is faster and never needs prime factorizations.
- Stopping one step early — the GCD is the last nonzero remainder, not the zero one.
- Applying LCM = a × b without dividing by the GCD — that product is a common multiple, rarely the least one.
- Non-integers or negatives — GCD/LCM are defined for positive integers; reduce fractions first, take absolute values for signs.
- Pairwise folding mistakes on three-plus numbers — gcd(gcd(a,b),c) is the order; batching all at once is not the algorithm.
Limitations
- Positive integers only — fractions, decimals and polynomials need adapted algorithms.
- JavaScript precision caps inputs near 2⁵³; beyond that, use big-integer tooling.
- Does not output the prime factorization — the prime-factorization tool covers that view.
Expected Accuracy
Integer-exact arithmetic — modulo and multiplication carry no rounding. Results are exact up to the precision limit of the platform's integers.
Privacy — Your Data Never Leaves This Device
Everything is computed locally: no inputs stored or sent, no tracking — the tool works offline too.
Related Tools & Guides
Natural next steps from GCD & LCM:
- All Utilities Calculators
- Ratio Simplifier — GCD applied to ratios
- Fraction Calculator — GCD reduces, LCM adds
- Prime Factorization — the alternative route to both
- Percentage Calculator
Sources & Standards
The Euclidean algorithm appears in Euclid's Elements (Book VII) and is unchanged in modern number theory.
- Wolfram MathWorld — Euclidean Algorithm (reference)
Bottom Line
Remainders down to zero give the GCD; one multiplication and division gives the LCM. Two thousand years old and still the fastest way.
From Our Guides Library
Frequently Asked Questions
How do I calculate the GCD of two numbers?
Run the Euclidean algorithm: repeatedly replace the pair with (smaller, remainder of larger ÷ smaller) until the remainder is zero. For 48 and 180: remainders 36, 12, 0 → GCD 12.
How do I find the LCM?
LCM(a, b) = a × b ÷ GCD(a, b). For 48 and 180: 8,640 ÷ 12 = 720.
Why does the Euclidean algorithm work?
Any common divisor of a and b also divides a mod b, so each step preserves the greatest common divisor while shrinking the numbers — until the GCD is the last nonzero remainder.
What is the GCD used for?
Reducing fractions to lowest terms (48/180 → 4/15), simplifying ratios, and solving Diophantine problems — anywhere a shared divisor matters.
How do I find the GCD of three numbers?
Fold pairwise: gcd(gcd(a, b), c). The LCM folds the same way: lcm(lcm(a, b), c).
What is the relation between GCD and LCM?
For positive integers, GCD(a, b) × LCM(a, b) = a × b — the product counts shared factors twice, and dividing by the GCD leaves the least common multiple.
Is this calculator free and private?
Yes — it runs entirely in your browser with no sign-up, no upload and no tracking.
What does the tool calculate?
This page is a working gcd & lcm calculator: enter your values, read the figure, and follow the step list to see exactly how the answer was derived. Because it is fast and private — GCD & LCM Calculator runs entirely in your browser, nothing is uploaded, and no account is needed.
How is the result calculated?
The first steps are gcd(12,18) via euclidean algorithm = 6, then lcm = 12×18 / 6 = 36. Rounding follows standard display conventions — the underlying math keeps several decimal places until the gcd is shown.
What do I need to use the GCD & LCM Calculator?
The First Number and Second Number it asks for, or the page defaults if you just want to see the calculation work. Each input maps directly to the formula, and changing any one of them recalculates the gcd instantly.
What does the result from the tool mean?
The main number the gcd & lcm calculator returns is the gcd for your exact inputs, and the supporting figures and step list give it context. The model behind GCD & LCM Calculator covers the standard case; special cases, edge values, or jurisdiction-specific rules may need manual adjustment.
When is the page most useful?
Typical uses for GCD & LCM Calculator include planning and budgeting, comparing scenarios side by side, and double-checking a figure before acting on it — anywhere the figure needs to be defensible rather than guessed. On this page, gcd & lcm calculator applies the standard Utilities method to your inputs and lists every step of the working beside the result.