How this GCF calculator works
Type in your numbers and you get four things at once: the greatest common factor (GCF), the least common multiple (LCM), the complete list of factors for each number, and the prime factorization of each number. You also get the working, step by step, with your actual numbers substituted in. There are two classic ways to find a GCF, and the radio above lets you pick which one the steps walk through.
The GCF (also called the GCD or HCF, same thing) is the largest number that divides evenly into every number you entered. The LCM is the smallest number that every number you entered divides into evenly. They answer opposite questions, and together they cover most of what factoring gets used for: simplifying fractions, adding fractions, splitting things into equal groups, and finding when repeating cycles line up.
The formula
In the first line (the Euclidean algorithm), a is the larger number, b is the smaller, q is the whole-number quotient, and r is the remainder. Each round, the pair (a, b) becomes (b, r), and the numbers shrink fast. The second line is the identity linking GCF and LCM for any two positive whole numbers: once you know one, a single division gives you the other.
Method 1: prime factorization
Break each number down into primes, then keep only the primes that appear in every factorization, each raised to the lowest power it reaches. Multiply those together and you have the GCF. For the LCM, do the mirror image: take every prime that appears anywhere, each at its highest power.
This method is worth learning because it shows you why the answer is what it is. The GCF is literally the overlap of the numbers' prime ingredients. Its weakness is practical: factoring big numbers is slow, for you and (at truly large scales) for computers too. That difficulty is not a quirk; it is the foundation of modern encryption.
Method 2: the Euclidean algorithm
Euclid published this procedure around 300 BC in the Elements, Book VII, which makes it roughly 2,300 years old. It is often called the oldest algorithm still in everyday use, and here is the remarkable part: nobody has found a fundamentally faster general method since. Your phone runs it (or a close variant) every time it negotiates an encrypted connection. Very few ideas in any field survive 23 centuries without being replaced.
The insight is simple and lovely: any number that divides both a and b must also divide their remainder when you divide one by the other. So GCF(a, b) = GCF(b, r), and you can keep replacing the big problem with a strictly smaller one until the remainder hits 0. No factoring required, which is why it stays fast even for numbers with hundreds of digits. Try it above on 1071 and 462 and watch it land on 21 in three lines.
Worked example
Find the GCF and LCM of 24 and 36.
Prime factorization method: 24 = 2^3 x 3 and 36 = 2^2 x 3^2. The common primes are 2 and 3; take the lowest power of each: 2^2 x 3 = 12. For the LCM take the highest powers: 2^3 x 3^2 = 72.
Euclidean algorithm: 36 = 24 x 1 + 12, then 24 = 12 x 2 + 0. The last nonzero remainder is 12, so GCF = 12.
Check with the identity: GCF x LCM = 12 x 72 = 864 = 24 x 36.
What the GCF is actually for: simplifying fractions
The single most common real use of the GCF is reducing a fraction in one step. Divide the top and bottom by their GCF and you are done: 24/36 becomes 2/3 because the GCF of 24 and 36 is 12. Divide by anything smaller (say, 2) and you will have to keep going. The GCF is the one divisor that finishes the job immediately.
The LCM handles the other half of fraction work: adding and subtracting. To add 1/24 and 1/36 you need a common denominator, and the LCM (72) is the smallest one that works. Using the LCM instead of just multiplying the denominators together keeps the numbers small and the final answer already reduced, or close to it.
One caution worth stating plainly: a GCF of 1 does not mean anything went wrong. It means your numbers are coprime, sharing no factor beyond 1, and the fraction they form is already in lowest terms.