LCM and HCF (GCD) Calculator With Prime Factorisation and Euclid's Steps
Type 2 to 10 whole numbers to get the LCM (least common multiple) and the HCF (highest common factor, also called GCD or GCF). You also see the prime factorisation of every number and Euclid’s algorithm step by step, so you can copy the method into your notebook. Nothing is saved.
- PriceFree, no login or sign-up needed
- Your dataCalculated in your browser; nothing is saved
- Works onPhone, tablet or computer, any modern browser
- Made byDr. Muhammad Aammar Tufail, Codanics
- Published24 November 2026
- Last updated24 November 2026
📚 How to cite this tool
This tool is free. If it helped your thesis, paper, report or assignment, please cite it. It keeps the tools free and helps other students find them.
Tufail, M. A. (2026). LCM and HCF calculator [Online tool]. Codanics. Retrieved 24 November 2026, from https://codanics.com/tools/lcm-hcf-calculator/
In-text citation: (Tufail, 2026) · Narrative: Tufail (2026)
The access date is today’s date, filled in automatically. Author: Muhammad Aammar Tufail. Published 24 November 2026.
How to use the lcm and hcf calculator
- Type 2 to 10 positive whole numbers, separated by spaces or commas (for example
12, 18, 30). - The HCF and LCM appear at once, with the prime factorisation of each number in a table.
- Scroll the working to see Euclid’s algorithm and the LCM built up two numbers at a time, or press Copy result.
What are the LCM and HCF?
The HCF (highest common factor) is the largest whole number that divides all the given numbers exactly; the LCM (least common multiple) is the smallest positive number that all of them divide into exactly. The HCF is also called the GCD (greatest common divisor) or GCF (greatest common factor). For 12, 18 and 30, the HCF is 6 and the LCM is 180.
Method 1: prime factorisation
Write each number as a product of primes. The HCF uses the lowest power of each prime that appears in every number. The LCM uses the highest power of every prime that appears.
| Number | Prime factors |
|---|---|
| 12 | 2² × 3 |
| 18 | 2 × 3² |
| 30 | 2 × 3 × 5 |
| HCF | 2 × 3 = 6 |
| LCM | 2² × 3² × 5 = 180 |
Method 2: Euclid’s algorithm
Euclid’s algorithm finds the HCF of two numbers by repeated division. Divide the bigger number by the smaller, then divide the smaller number by the remainder, and keep going until the remainder is 0. The last non-zero remainder is the HCF.
It is very fast even for large numbers, because you never need to find prime factors. For more than two numbers, find the HCF of the first two, then the HCF of that answer and the next number, and so on.
The LCM from the HCF
For two numbers, HCF × LCM = a × b, so LCM(a, b) = a × b ÷ HCF(a, b). For 12 and 18: 12 × 18 ÷ 6 = 36. For more numbers, work two at a time: LCM(12, 18) = 36, then LCM(36, 30) = 36 × 30 ÷ 6 = 180. (The product rule only holds for two numbers, not three or more.)
Where you use them
- LCM: the lowest common denominator when adding fractions; when two buses or events repeat together (every 12 and 18 minutes → together every 36 minutes).
- HCF: simplifying fractions and ratios (84/126 ÷ 42 = 2/3); cutting things into the largest equal pieces (ribbons of 12 m and 18 m → pieces of 6 m).
Frequently asked questions
What is the difference between LCM and HCF?
The HCF is the biggest number that divides all the numbers exactly. The LCM is the smallest number that all the numbers divide into exactly. For 4 and 6, the HCF is 2 and the LCM is 12.
Are HCF, GCD and GCF the same?
Yes. Highest common factor (HCF), greatest common divisor (GCD) and greatest common factor (GCF) are three names for the same thing.
How do I find the LCM using prime factorisation?
Write each number as a product of primes and multiply the highest power of every prime that appears. For 12 = 2² × 3 and 18 = 2 × 3², the LCM is 2² × 3² = 36.
What is the relationship between HCF and LCM?
For two numbers, HCF × LCM equals the product of the numbers. For 12 and 18: 6 × 36 = 216 = 12 × 18. This does not hold for three or more numbers.
What does it mean if the HCF is 1?
The numbers are co-prime (relatively prime): they share no prime factor. Their LCM is then the product of the numbers, for two numbers.
Does this calculator save my numbers?
No. Everything is calculated in your browser and nothing is saved or uploaded. When you close the page, your numbers are gone.
Do I need to log in or create an account to use the lcm and hcf calculator?
No. There is no login, no sign-up and no email required. Open the page and start using it straight away, for free, on any device.
How do I cite this tool in my thesis or paper?
Use the citation box on this page. In APA 7th edition: Tufail, M. A. (2026). LCM and HCF calculator [Online tool]. Codanics. Retrieved [date you used it], from https://codanics.com/tools/lcm-hcf-calculator/. BibTeX, RIS (EndNote, Mendeley, Zotero), MLA, Harvard, Chicago and Vancouver formats are also available.
Free guides and courses from Codanics
More free tools
See all free Codanics tools → · Codanics on YouTube · WhatsApp channel