LCM and GCD Calculator
Find the LCM and HCF of two numbers. Follow the Euclidean algorithm, then copy or download the calculation with exact integer results.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
LCM and GCD Calculator
Greatest common divisor and least common multiple of two numbers.
The LCM and GCD Calculator finds the greatest common divisor (GCD, also called HCF) and the least common multiple (LCM) of two whole numbers. It uses the Euclidean algorithm — repeatedly replacing the pair with the smaller number and the remainder until the remainder is zero — and then derives the LCM from the identity LCM(a, b) = a x b / GCD(a, b), computed as (a / g) x b so the intermediate product stays small. Enter 12 and 18 and it returns GCD 6 and LCM 36.
How to use LCM and GCD Calculator
Type a value into the 'First number' box under Inputs, which opens at 12. Decimals are floored and negatives are made positive, so 12.9 and -12 are both treated as 12.
Fill in the 'Second number' box, which opens at 18. Enter 0 in either box and the Result stays an em dash with the caption 'Enter two whole numbers'.
There is no calculate button — the Result recomputes as you type, reading 'GCD 6 · LCM 36' for the default 12 and 18, with cards labelled 'GCD (HCF)' and 'LCM' beneath it. Copy sends that text to the clipboard, Download saves it as lcm-and-gcd-calculator.txt, and Reset returns the boxes to 12 and 18.
Why use LCM and GCD Calculator
Both answers from one input
GCD and LCM are returned together, which is what you usually need, since one is derived from the other.
Euclidean algorithm steps
See each division and its remainder, then the formula that uses the GCD to calculate the LCM.
Inputs normalised for you
Values are taken as whole numbers and signs ignored, so a negative or decimal entry still returns the divisor and multiple of the magnitudes.
Common use cases
- You are reducing a fraction such as 84/126 to its lowest terms and need the common factor to divide out — the GCD is 42, giving 2/3.
- Two events repeat on different cycles, one every 12 days and one every 18, and you want the next day both fall together, which is the LCM: 36 days.
- You are adding fractions with denominators of 8 and 12 and need the lowest common denominator before you can add them — that is the LCM, 24.
Frequently asked questions
Can I see and download the steps for finding the GCD and LCM?
Yes. The result shows each Euclidean division and a final LCM calculation. Use Copy or Download to save the inputs, exact results and steps together.
Link to answerWhat is the difference between GCD and LCM?
The GCD is the largest number that divides both values exactly; the LCM is the smallest number both values divide into exactly. For 12 and 18 the GCD is 6 and the LCM is 36 — the GCD is never larger than the smaller input, and the LCM is never smaller than the larger one.
Link to answerIs HCF the same as GCD?
Yes. Highest common factor (HCF), greatest common divisor (GCD) and greatest common factor (GCF) all name the same quantity; HCF is the usual term in Indian and British syllabuses and GCD the usual term elsewhere.
Link to answerHow do you find the LCM from the GCD?
Multiply the two numbers and divide by their GCD: LCM(a, b) = a x b / GCD(a, b). For 12 and 18 that is 216 / 6 = 36. This identity holds for any pair of positive integers, which is why one calculation gives both results.
Link to answerWhat is the GCD when the two numbers share no factors?
Link to answerEmbed this tool on your site
Add the LCM and GCD Calculator widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/lcm-and-gcd-calculator"
title="LCM and GCD Calculator — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/lcm-and-gcd-calculator?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>