LCM & GCD Calculator
Tell us more, and we'll get back to you.
Contact UsTell us more, and we'll get back to you.
Contact UsTell us more, and we'll get back to you.
Contact UsThe Greatest Common Divisor (GCD), also known as the Greatest Common Factor (GCF) or Highest Common Factor (HCF), is the largest positive integer that divides each of the given numbers without a remainder. The Least Common Multiple (LCM) is the smallest positive integer that is a multiple of each of the given numbers.
For any two positive integers a and b: LCM(a, b) × GCD(a, b) = |a × b|. This fundamental identity connects the two concepts and provides an efficient way to compute LCM from GCD.
The Euclidean algorithm is one of the oldest known algorithms, dating back to around 300 BC. It efficiently computes the GCD by repeatedly applying the division algorithm: divide the larger number by the smaller, then replace the larger with the remainder, and repeat until the remainder is zero.
Prime factorization decomposes a number into its prime factors. Using prime factorizations, the GCD is the product of common prime factors with the lowest exponents, while the LCM is the product of all prime factors with the highest exponents.
GCD and LCM can be found several ways, and the best method depends on the size and form of the numbers. For small numbers, listing factors or multiples can be quick and easy to understand. For larger numbers, listing becomes slow and error-prone. The Euclidean algorithm is usually better because it reduces the problem through division remainders and reaches the answer quickly even when the inputs are large.
Prime factorization is helpful when you need to understand the structure of the numbers, not only the final answer. It shows which prime factors are shared and which are unique. The GCD uses only the common prime factors with the smaller exponent. The LCM uses every prime factor that appears, taking the larger exponent. This method is useful for simplifying fractions, comparing algebraic terms, and teaching why the GCD and LCM relationship works.
The identity GCD(a, b) times LCM(a, b) equals the absolute value of a times b is often the fastest way to get the LCM after the GCD is known. It also reduces overflow risk if implemented carefully by dividing before multiplying. For example, if the GCD of 84 and 126 is 42, the LCM is 84 divided by 42, then multiplied by 126, which gives 252. Dividing first keeps the intermediate number smaller.
Zero and negative numbers need clear rules. The GCD is normally reported as nonnegative. The GCD of zero and a nonzero integer is the absolute value of the nonzero integer because every integer divides zero. The LCM of zero and any integer is usually defined as zero because zero is the only multiple shared by zero and another number under that convention. When both inputs are zero, the GCD is often left undefined or reported as zero by calculators, depending on the chosen rule.
Fraction arithmetic is the most familiar use. The GCD reduces fractions to lowest terms, and the LCM finds a common denominator for addition or subtraction. If two fractions have denominators 12 and 18, the least common denominator is 36. That value is smaller and cleaner than multiplying the denominators to get 216. Using the LCM keeps the arithmetic easier and the final fraction simpler.
Scheduling problems also rely on LCM. If one task repeats every 6 days and another repeats every 8 days, both occur together every 24 days. The same idea appears in maintenance plans, rotating shifts, medicine reminders, traffic signal timing, and recurring subscriptions. LCM answers the question of when cycles line up again.
GCD appears in grouping and layout problems. If a room is 84 inches by 126 inches and you want the largest square tile size that fits both dimensions exactly, the answer is the GCD, 42 inches. The same reasoning applies to cutting boards, dividing supplies into equal kits, arranging pixels, or packaging items without leftovers. GCD answers the question of the largest equal unit that fits all quantities.
In computing, these operations support modular arithmetic, cryptography, rational number simplification, graphics grids, rhythm generation, and signal periods. The calculator provides the result, but understanding the role of each value helps you decide whether you need a shared divisor, a shared multiple, or both.
A quick reasonableness check prevents many mistakes. The GCD can never be larger than the smallest nonzero input because it must divide that input. The LCM can never be smaller than the largest nonzero input because it must be a multiple of that input. If a calculated GCD is larger than one of the numbers, or an LCM is smaller than one of the numbers, the result has been mixed up or calculated incorrectly.
Divisibility checks are also easy. After finding a GCD, divide each input by it. Every division should leave no remainder. After finding an LCM, divide the LCM by each input. Again, every division should be exact, except when the inputs include zero under a zero-LCM convention. These checks are simple and catch errors in arithmetic, factorization, and data entry.
Prime numbers create a helpful pattern. If two numbers are prime and different, their GCD is 1 and their LCM is the product of the two numbers. If one number is a multiple of the other, the smaller number is the GCD and the larger number is the LCM. For example, with 9 and 36, the GCD is 9 and the LCM is 36. Recognizing these cases makes mental checks much faster.
More than two inputs can be handled step by step. The GCD of several numbers can be found by taking the GCD of the first two, then the GCD of that result with the next number, and so on. The LCM works the same way using pairwise LCM calculations. This approach is efficient and avoids trying to factor every number at once, although prime factorization may still be clearer for teaching.
Word problems often reveal whether GCD or LCM is needed. If the problem asks for the largest equal group size, largest square tile, or biggest identical package with no leftovers, it is usually a GCD problem. If the problem asks when cycles repeat together, when events line up, or what common denominator to use, it is usually an LCM problem. The words largest and least are helpful, but the underlying idea is more reliable than keywords alone.
In fraction work, using both values can simplify the process. The LCM gives the least common denominator for addition or subtraction. The GCD then reduces the final numerator and denominator if needed. This keeps numbers smaller than using the product of denominators and reduces cleanup at the end. Smaller intermediate numbers mean fewer arithmetic mistakes.
The calculator is especially helpful for large values, but the same checks still apply. Confirm the GCD divides every input. Confirm the LCM is divisible by every input. If there are only two positive inputs, multiply the GCD and LCM and compare the result with the product of the inputs. Matching products are a strong sign that both values are consistent.
When a GCD is used to simplify a fraction, divide both numerator and denominator by the same value. If the result still has a common divisor, the original GCD was not the greatest one. This quick follow-up check confirms the fraction is fully reduced.
When an LCM is used as a common denominator, convert each fraction by multiplying numerator and denominator by the same factor. The factor is the LCM divided by the original denominator. This keeps the value of each fraction unchanged while making addition or subtraction possible.
In scheduling problems, confirm that the starting time is shared. If two events repeat every 6 and 10 days but start on different days, the LCM gives the cycle length after alignment, not necessarily the first calendar date they meet. The starting offset must be handled separately.
For large numbers, calculator output is useful for checking code, spreadsheets, and manual work. Store both GCD and LCM when possible because each value explains a different part of the number relationship.
If the inputs are positive, the GCD should divide each number and the LCM should be divisible by each number. For two inputs, multiplying the two results should match the product of the inputs. These checks make the calculator result easier to trust.
The GCD (Greatest Common Divisor) is the largest positive integer that divides two or more numbers without a remainder. The LCM (Least Common Multiple) is the smallest positive integer that is divisible by all the given numbers. For example, for 12 and 18, the GCD is 6 and the LCM is 36.
The Euclidean algorithm finds the GCD by repeatedly dividing the larger number by the smaller and taking the remainder. For example, GCD(48, 18): 48 ÷ 18 = 2 remainder 12, then 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0. Since the remainder is 0, the GCD is 6.
The LCM of two numbers a and b can be calculated using the formula: LCM(a, b) = |a × b| / GCD(a, b). This is more efficient than listing all multiples. For multiple numbers, compute LCM iteratively: LCM(a, b, c) = LCM(LCM(a, b), c).
Prime factorization breaks a number into its prime factors (e.g., 12 = 2² × 3). The GCD is found by taking the lowest power of each common prime factor, while the LCM is found by taking the highest power of each prime factor across all numbers.
GCD is used for simplifying fractions (e.g., 12/18 simplifies to 2/3 by dividing by GCD 6), tiling problems, and distributing items equally. LCM is used for finding common denominators when adding fractions, scheduling recurring events, and synchronizing cycles.
Yes. For multiple numbers, compute GCD or LCM pairwise and iteratively. For example, GCD(a, b, c) = GCD(GCD(a, b), c) and LCM(a, b, c) = LCM(LCM(a, b), c). This calculator supports up to 10 numbers.
Embed on Your Website
Add this calculator to your website
The Greatest Common Divisor (GCD), also known as the Greatest Common Factor (GCF) or Highest Common Factor (HCF), is the largest positive integer that divides each of the given numbers without a remainder. The Least Common Multiple (LCM) is the smallest positive integer that is a multiple of each of the given numbers.
For any two positive integers a and b: LCM(a, b) × GCD(a, b) = |a × b|. This fundamental identity connects the two concepts and provides an efficient way to compute LCM from GCD.
The Euclidean algorithm is one of the oldest known algorithms, dating back to around 300 BC. It efficiently computes the GCD by repeatedly applying the division algorithm: divide the larger number by the smaller, then replace the larger with the remainder, and repeat until the remainder is zero.
Prime factorization decomposes a number into its prime factors. Using prime factorizations, the GCD is the product of common prime factors with the lowest exponents, while the LCM is the product of all prime factors with the highest exponents.
GCD and LCM can be found several ways, and the best method depends on the size and form of the numbers. For small numbers, listing factors or multiples can be quick and easy to understand. For larger numbers, listing becomes slow and error-prone. The Euclidean algorithm is usually better because it reduces the problem through division remainders and reaches the answer quickly even when the inputs are large.
Prime factorization is helpful when you need to understand the structure of the numbers, not only the final answer. It shows which prime factors are shared and which are unique. The GCD uses only the common prime factors with the smaller exponent. The LCM uses every prime factor that appears, taking the larger exponent. This method is useful for simplifying fractions, comparing algebraic terms, and teaching why the GCD and LCM relationship works.
The identity GCD(a, b) times LCM(a, b) equals the absolute value of a times b is often the fastest way to get the LCM after the GCD is known. It also reduces overflow risk if implemented carefully by dividing before multiplying. For example, if the GCD of 84 and 126 is 42, the LCM is 84 divided by 42, then multiplied by 126, which gives 252. Dividing first keeps the intermediate number smaller.
Zero and negative numbers need clear rules. The GCD is normally reported as nonnegative. The GCD of zero and a nonzero integer is the absolute value of the nonzero integer because every integer divides zero. The LCM of zero and any integer is usually defined as zero because zero is the only multiple shared by zero and another number under that convention. When both inputs are zero, the GCD is often left undefined or reported as zero by calculators, depending on the chosen rule.
Fraction arithmetic is the most familiar use. The GCD reduces fractions to lowest terms, and the LCM finds a common denominator for addition or subtraction. If two fractions have denominators 12 and 18, the least common denominator is 36. That value is smaller and cleaner than multiplying the denominators to get 216. Using the LCM keeps the arithmetic easier and the final fraction simpler.
Scheduling problems also rely on LCM. If one task repeats every 6 days and another repeats every 8 days, both occur together every 24 days. The same idea appears in maintenance plans, rotating shifts, medicine reminders, traffic signal timing, and recurring subscriptions. LCM answers the question of when cycles line up again.
GCD appears in grouping and layout problems. If a room is 84 inches by 126 inches and you want the largest square tile size that fits both dimensions exactly, the answer is the GCD, 42 inches. The same reasoning applies to cutting boards, dividing supplies into equal kits, arranging pixels, or packaging items without leftovers. GCD answers the question of the largest equal unit that fits all quantities.
In computing, these operations support modular arithmetic, cryptography, rational number simplification, graphics grids, rhythm generation, and signal periods. The calculator provides the result, but understanding the role of each value helps you decide whether you need a shared divisor, a shared multiple, or both.
A quick reasonableness check prevents many mistakes. The GCD can never be larger than the smallest nonzero input because it must divide that input. The LCM can never be smaller than the largest nonzero input because it must be a multiple of that input. If a calculated GCD is larger than one of the numbers, or an LCM is smaller than one of the numbers, the result has been mixed up or calculated incorrectly.
Divisibility checks are also easy. After finding a GCD, divide each input by it. Every division should leave no remainder. After finding an LCM, divide the LCM by each input. Again, every division should be exact, except when the inputs include zero under a zero-LCM convention. These checks are simple and catch errors in arithmetic, factorization, and data entry.
Prime numbers create a helpful pattern. If two numbers are prime and different, their GCD is 1 and their LCM is the product of the two numbers. If one number is a multiple of the other, the smaller number is the GCD and the larger number is the LCM. For example, with 9 and 36, the GCD is 9 and the LCM is 36. Recognizing these cases makes mental checks much faster.
More than two inputs can be handled step by step. The GCD of several numbers can be found by taking the GCD of the first two, then the GCD of that result with the next number, and so on. The LCM works the same way using pairwise LCM calculations. This approach is efficient and avoids trying to factor every number at once, although prime factorization may still be clearer for teaching.
Word problems often reveal whether GCD or LCM is needed. If the problem asks for the largest equal group size, largest square tile, or biggest identical package with no leftovers, it is usually a GCD problem. If the problem asks when cycles repeat together, when events line up, or what common denominator to use, it is usually an LCM problem. The words largest and least are helpful, but the underlying idea is more reliable than keywords alone.
In fraction work, using both values can simplify the process. The LCM gives the least common denominator for addition or subtraction. The GCD then reduces the final numerator and denominator if needed. This keeps numbers smaller than using the product of denominators and reduces cleanup at the end. Smaller intermediate numbers mean fewer arithmetic mistakes.
The calculator is especially helpful for large values, but the same checks still apply. Confirm the GCD divides every input. Confirm the LCM is divisible by every input. If there are only two positive inputs, multiply the GCD and LCM and compare the result with the product of the inputs. Matching products are a strong sign that both values are consistent.
When a GCD is used to simplify a fraction, divide both numerator and denominator by the same value. If the result still has a common divisor, the original GCD was not the greatest one. This quick follow-up check confirms the fraction is fully reduced.
When an LCM is used as a common denominator, convert each fraction by multiplying numerator and denominator by the same factor. The factor is the LCM divided by the original denominator. This keeps the value of each fraction unchanged while making addition or subtraction possible.
In scheduling problems, confirm that the starting time is shared. If two events repeat every 6 and 10 days but start on different days, the LCM gives the cycle length after alignment, not necessarily the first calendar date they meet. The starting offset must be handled separately.
For large numbers, calculator output is useful for checking code, spreadsheets, and manual work. Store both GCD and LCM when possible because each value explains a different part of the number relationship.
If the inputs are positive, the GCD should divide each number and the LCM should be divisible by each number. For two inputs, multiplying the two results should match the product of the inputs. These checks make the calculator result easier to trust.
The GCD (Greatest Common Divisor) is the largest positive integer that divides two or more numbers without a remainder. The LCM (Least Common Multiple) is the smallest positive integer that is divisible by all the given numbers. For example, for 12 and 18, the GCD is 6 and the LCM is 36.
The Euclidean algorithm finds the GCD by repeatedly dividing the larger number by the smaller and taking the remainder. For example, GCD(48, 18): 48 ÷ 18 = 2 remainder 12, then 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0. Since the remainder is 0, the GCD is 6.
The LCM of two numbers a and b can be calculated using the formula: LCM(a, b) = |a × b| / GCD(a, b). This is more efficient than listing all multiples. For multiple numbers, compute LCM iteratively: LCM(a, b, c) = LCM(LCM(a, b), c).
Prime factorization breaks a number into its prime factors (e.g., 12 = 2² × 3). The GCD is found by taking the lowest power of each common prime factor, while the LCM is found by taking the highest power of each prime factor across all numbers.
GCD is used for simplifying fractions (e.g., 12/18 simplifies to 2/3 by dividing by GCD 6), tiling problems, and distributing items equally. LCM is used for finding common denominators when adding fractions, scheduling recurring events, and synchronizing cycles.
Yes. For multiple numbers, compute GCD or LCM pairwise and iteratively. For example, GCD(a, b, c) = GCD(GCD(a, b), c) and LCM(a, b, c) = LCM(LCM(a, b), c). This calculator supports up to 10 numbers.
Embed on Your Website
Add this calculator to your website