Common Factor Calculator - GCD, HCF, and LCM
Find the greatest common divisor, least common multiple, and every shared factor of two or more positive integers. Runs in your browser - nothing is uploaded.
Input Values
Separate values with commas, spaces, or new lines. Example: 48, 18, 30
Results update as you type. Only positive whole numbers are accepted - not 0, negatives, or decimals. Common-factor listing is skipped when the GCD is greater than 1,000,000,000.
GCD, LCM, and Factors
What Is a Common Factor Calculator and When Do You Need GCD or LCM?
A common factor calculator takes two or more positive integers and answers three related questions at once: what is the largest integer that divides every input (the greatest common divisor, written GCD and also called the highest common factor or HCF); what is the smallest positive integer that every input divides (the least common multiple, or LCM); and what is the complete list of positive integers that divide all of the inputs. That last list is not a mystery - it is exactly the set of positive divisors of the GCD.
School worksheets often ask you to “list the common factors of 48 and 18” or “find the HCF of 48, 18, and 30.” Those are the same task. The factors of 48 are 1, 2, 3, 4, 6, 8, 12, 16, 24, 48. The factors of 18 are 1, 2, 3, 6, 9, 18. The overlap is 1, 2, 3, 6, and the largest of those is 6, which is gcd(48, 18). Once you know the GCD, you do not need to factor every number separately: every common factor divides 6, so the common-factor list is just 1, 2, 3, 6. This page uses that identity so three, four, or twenty numbers are handled the same way.
LCM shows up in a different kind of problem: when will two repeating events coincide, or what denominator should you use to add fractions. For two positives, lcm(a, b) = |a · b| / gcd(a, b). For 48 and 18 that is (48 × 18) / 6 = 144. For more than two numbers you fold: lcm(a, b, c) = lcm(lcm(a, b), c). This free online GCD and LCM tool runs entirely in the browser with BigInt arithmetic, so typical homework sizes and moderately large integers are exact - not floating-point approximations.
How to Use This Free Online Common Factor Calculator
The HCF calculator is built for paste-and-read homework checks, not for a multi-step form:
- Type two or more positive integers in the input box. Separate them with commas, spaces, or new lines. A typical triple is
48, 18, 30. - Read the GCD (HCF) in the result panel. That value is the largest integer that divides every number you entered. Euclid’s algorithm is applied pairwise across the whole list.
- Read the LCM and the common-factor list. The list is every positive divisor of the GCD, printed in ascending order. When the GCD itself is larger than one billion, listing is skipped so the browser stays responsive; GCD and LCM still appear.
- Optionally copy the full summary, or clear the box to start over. The last input is stored locally in your browser for up to 30 days.
Note: decimals, zero, and negatives are rejected on purpose. GCD and LCM here are defined for positive integers. If you have 1.5 and 2.5, scale them first (15 and 25) and interpret the result in the scaled units.
GCD, HCF, and LCM Formulas with Worked Numbers
Euclid’s algorithm replaces a pair (a, b) with (b, a mod b) until the remainder is 0. The last non-zero remainder is the GCD. It never needs a complete prime factorization, which is why it stays fast even when the integers have many digits. This calculator uses BigInt so the remainders are exact.
Example - gcd(48, 18):
- 48 = 2 × 18 + 12, so gcd(48, 18) = gcd(18, 12)
- 18 = 1 × 12 + 6, so gcd(18, 12) = gcd(12, 6)
- 12 = 2 × 6 + 0, so gcd(12, 6) = 6
- GCD / HCF = 6. Common factors: 1, 2, 3, 6.
Example - three numbers 48, 18, 30:
- gcd(48, 18) = 6, then gcd(6, 30) = 6
- lcm(48, 18) = 48 × 18 / 6 = 144, then lcm(144, 30) = 144 × 30 / gcd(144, 30). gcd(144, 30) = 6, so LCM = 720.
- GCD = 6, LCM = 720, common factors still 1, 2, 3, 6 because they are the divisors of 6.
Example - coprime pair 8 and 15:
- gcd(8, 15) = 1 (the numbers are coprime). The only common factor is 1.
- lcm(8, 15) = 120, which is simply the product.
When the GCD is large, listing every divisor can produce thousands of values and stall a tab. This tool therefore enumerates common factors only when the GCD is at most 1,000,000,000. Homework GCDs are almost always far smaller than that. For a prime-power breakdown of a single integer - not just of the GCD - use the prime factorization calculator.
GCD vs LCM vs Common Factors - What Each Answer Means
| Quantity | For 48 and 18 | Meaning | Typical use |
|---|---|---|---|
| GCD / HCF | 6 | Largest integer dividing both | Reduce a fraction; simplify a ratio |
| Common factors | 1, 2, 3, 6 | Every positive divisor of the GCD | Factor-list homework; grouping objects |
| LCM | 144 | Smallest positive common multiple | Common denominators; repeating schedules |
| Product check | 48 × 18 = 6 × 144 | gcd × lcm = |a · b| for two positives | Quick sanity check of both answers |
The identity gcd(a, b) × lcm(a, b) = |a · b| holds for two positive integers. It does not extend in the same one-line way to three numbers: gcd(48, 18, 30) × lcm(48, 18, 30) = 6 × 720 = 4320, while 48 × 18 × 30 = 25920. Do not use the two-number product check on a triple. Compute LCM by reducing pairwise instead.
Where GCD, HCF, and LCM Show Up Outside the Worksheet
1. Reducing fractions
48/18 simplifies by dividing numerator and denominator by gcd(48, 18) = 6, which yields 8/3. Any common factor would cancel some of the fraction; the GCD cancels all of it in one step. The same idea reduces ratios of three or more quantities by dividing each by the overall GCD.
2. Adding fractions
1/48 + 1/18 needs a common denominator. The least such denominator is lcm(48, 18) = 144, so the sum is 3/144 + 8/144 = 11/144. Using a larger common multiple still works, but the LCM keeps the arithmetic smaller.
3. Repeating events and gears
If one light blinks every 48 seconds and another every 18 seconds, they blink together every 144 seconds. Gear-tooth counts, tile patterns, and calendar cycles are the same LCM problem: the first time several periods line up.
4. Splitting into equal groups
You have 48 red tiles and 18 blue tiles and want equal mixed bundles with none left over. The number of bundles must divide both counts, so it is a common factor; the largest number of bundles is the GCD, namely 6 bundles of 8 red and 3 blue.
5. Cryptography and huge integers
Euclid’s algorithm is the engine behind many number-theory routines. This page is a homework tool, not a crypto library, but the same remainder loop is what computers use on integers far larger than 48 and 18. If you need exact arithmetic on giant integers beyond GCD/LCM, try the big number calculator.
Euclid’s Algorithm on Paper - Why Remainders Find the GCD
The reason gcd(a, b) = gcd(b, a mod b) is that any common divisor of a and b also divides a − qb for any integer q, and in particular divides the remainder a mod b. Working in the other direction, any common divisor of b and the remainder divides a = qb + remainder. So the common-divisor sets of (a, b) and of (b, a mod b) are identical, and so is the greatest one. Repeating the step shrinks the numbers until a remainder of 0 appears; the previous remainder is then the GCD.
Prime factorizations give the same GCD another way: write each number as a product of primes and keep the minimum exponent for every prime. 48 = 24 × 3, 18 = 2 × 32, 30 = 2 × 3 × 5, so the GCD is 21 × 31 = 6. The LCM keeps the maximum exponents: 24 × 32 × 5 = 16 × 9 × 5 = 720. Factor trees are excellent for small homework numbers and painful for large ones; Euclid does not care how many prime factors hide inside the inputs.
Coprime integers (GCD 1) still have LCM equal to their product. That is why 8 and 15 give LCM 120, and why two distinct primes always have LCM equal to that product. If every number in a list is a multiple of the same integer k, you can divide each by k, compute GCD or LCM of the smaller list, then scale back: gcd(ka, kb) = k · gcd(a, b) for positive k.
A frequent homework trap is listing factors of only one number. The factors of 48 include 8 and 16, but those do not divide 18, so they are not common. Another trap is treating GCD as “the overlap of the prime lists” without taking minimum exponents: 48 and 18 both contain a 2, but 48 has four factors of 2 while 18 has one, so the GCD keeps only 21. A third trap is computing LCM by multiplying all three inputs and dividing by the GCD once - that overcounts. Always fold LCM pairwise: lcm(lcm(48, 18), 30) = lcm(144, 30) = 720.
When two numbers share no prime factors, students sometimes write GCD 0. Zero is a multiple of every integer, but it is not a divisor in the school-book sense used here, and this calculator rejects 0 as an input. Coprime pairs have GCD 1, never 0. Likewise LCM is never smaller than each input: lcm is at least the maximum of the numbers. If a result shows LCM 12 for inputs 12 and 18, that is wrong (the true LCM is 36); use the identity a × b = gcd × lcm on a pair to catch that class of error in a few seconds.
Frequently Asked Questions (FAQ) - Common Factors, GCD, and LCM
How do I find the GCD of two or more numbers?
Use Euclid’s algorithm: gcd(a, b) = gcd(b, a mod b), and fold extra numbers in as gcd(gcd(a, b), c), …. This calculator does that for every integer you enter and also reports the same value as HCF.
What is the difference between GCD and LCM?
GCD (greatest common divisor, also called HCF) is the largest integer that divides every input. LCM (least common multiple) is the smallest positive integer that every input divides. For two positives, lcm(a, b) = |a·b| / gcd(a, b).
How do I list all common factors of three numbers?
First find gcd(a, b, c). The common factors of a, b, and c are exactly the positive divisors of that GCD. Listing factors of each number separately and intersecting the lists is slower but gives the same set.
Why are the common factors the same as the factors of the GCD?
Any integer that divides all of the inputs must divide their GCD. Conversely every divisor of the GCD divides each input. So the common-factor list is just the factor list of gcd(n1, n2, …).
Can I use decimals in a common factor calculator?
No. GCD, LCM, and common factors are defined here for positive integers only. Scale decimals to integers (for example 1.5 and 2.5 become 15 and 25 after multiplying by 10) if you need an analogous result.
Does this common factor calculator send my numbers to a server?
No. GCD, LCM, and the factor list are computed in your browser with JavaScript. Nothing is uploaded. After the page loads, the tool still works if the network drops.
Why Choose Our Common Factor Calculator?
- Free, no account. Unlimited GCD, HCF, and LCM calculations.
- Private. Euclid’s algorithm and the factor list run in the browser.
- Two or more integers in one box - not limited to a pair.
- Full common-factor list whenever the GCD is at most one billion.
- Prime factorization of the GCD so you can check a factor tree.
- Exact BigInt LCM with a guard when the result would exceed about 8,000 digits.
- Works offline after the first page load.
Related Tools
Discover more free developer tools that might interest you.
Area Calculator
Calculate area of squares, rectangles, triangles, circles, and more
Use ToolAverage Calculator
Calculate mean, median, mode, and range from a list of numbers
Use ToolBasic Calculator
Add, subtract, multiply, and divide with a free online calculator
Use ToolBig Number Calculator
Add, subtract, multiply, and divide integers too large for a standard calculator
Use ToolBinary Calculator
Add, subtract, and convert binary numbers to decimal and hex
Use ToolCircle Calculator
Find radius, diameter, circumference, area, arc length, and sector area
Use ToolRelated guides
Read the how-to, then come back to this tool when you are ready to run it locally.