How it’s calculated
The greatest common factor (GCF, also called GCD or HCF) is the largest whole number that divides every number in the list. The least common multiple (LCM) is the smallest positive number that every number in the list divides into. The LCM is the "lowest common denominator" you need to add fractions.
Both can be read off the prime factorizations: the GCF takes each prime the smallest number of times it appears in any number, and the LCM takes it the largest number of times. This calculator uses the Euclidean algorithm for the GCF and the identity below for the LCM, with exact (big integer) arithmetic.
Example: 12, 18, 24. Prime factors: 12 = 2² × 3, 18 = 2 × 3², 24 = 2³ × 3. GCF = 2 × 3 = 6 (lowest power of each prime). LCM = 2³ × 3² = 72 (highest power of each prime).
Frequently asked questions
What is the difference between GCF, GCD and HCF?
Nothing: greatest common factor, greatest common divisor and highest common factor are three names for the same number.
What is the GCF of numbers with nothing in common?
It is 1. Numbers whose GCF is 1 are called coprime (or relatively prime), and their LCM is simply their product.
How do I use the LCM to add fractions?
The LCM of the denominators is the smallest common denominator. For 1/4 + 1/6 the LCM of 4 and 6 is 12, so you add 3/12 + 2/12 = 5/12.
Why is a very large LCM shown as text?
LCMs grow fast. Above 9,007,199,254,740,991 a normal number can no longer store every digit exactly, so the exact value is shown in full as text.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping — OpenStax
- Prealgebra 2e, §2.4 Find Multiples and Factors — OpenStax
- Prealgebra 2e, §2.5 Prime Factorization and the Least Common Multiple — OpenStax
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator