Skip to main content

GCF and LCM Calculator

Solve gcfand lcmcalculator problems step-by-step with our free calculator. See formulas, worked examples, and clear explanations.

Skip to calculator
Mathematics

GCF and LCM Calculator

Calculate the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of any set of numbers. View prime factorizations, step-by-step solutions, and verify results.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate

Enter two or more positive integers separated by commas

Greatest Common Factor
6
Least Common Multiple
72

Prime Factorizations

12= 2^2 x 3
18= 2 x 3^2
24= 2^3 x 3
GCF = 6= 2 x 3
LCM = 72= 2^3 x 3^2
Divisors of GCF (6)
1236
Your Result
GCF = 6 | LCM = 72
Share Your Result
Understand the Math

Formula

GCF: product of common prime factors with lowest exponents | LCM: product of all prime factors with highest exponents

For two numbers a and b: GCF(a,b) x LCM(a,b) = a x b. The GCF uses the Euclidean algorithm (repeated division), while the LCM can be derived from the GCF using LCM(a,b) = |a x b| / GCF(a,b).

Last reviewed: December 2025

Worked Examples

Example 1: GCF and LCM of Two Numbers

Find the GCF and LCM of 48 and 36.
Solution:
Prime factorization: 48 = 2^4 x 3, 36 = 2^2 x 3^2 GCF = 2^2 x 3 = 12 (take lowest powers of shared primes) LCM = 2^4 x 3^2 = 144 (take highest powers of all primes) Verification: GCF x LCM = 12 x 144 = 1,728 = 48 x 36
Result: GCF = 12 | LCM = 144

Example 2: GCF and LCM of Three Numbers

Find the GCF and LCM of 12, 18, and 24.
Solution:
Prime factorizations: 12 = 2^2 x 3, 18 = 2 x 3^2, 24 = 2^3 x 3 GCF: lowest powers of shared primes = 2^1 x 3^1 = 6 LCM: highest powers of all primes = 2^3 x 3^2 = 72 All three numbers divide evenly into 72: 72/12=6, 72/18=4, 72/24=3
Result: GCF = 6 | LCM = 72
Expert Insights

Background & Theory

The GCF and LCM Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the GCF and LCM Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

The Greatest Common Factor, also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more numbers without leaving a remainder. For example, the GCF of 12 and 18 is 6 because 6 is the largest number that divides both 12 and 18 evenly. Finding the GCF is essential in simplifying fractions, factoring polynomials, and solving problems in number theory. The Euclidean algorithm is the most efficient classical method for computing the GCF of two numbers.
The Least Common Multiple is the smallest positive integer that is divisible by each of the given numbers. For instance, the LCM of 4 and 6 is 12 because 12 is the smallest number that both 4 and 6 divide into evenly. The LCM is widely used when adding or subtracting fractions with different denominators, scheduling recurring events, and solving problems involving periodicity. You can compute the LCM using prime factorization by taking the highest power of each prime factor that appears in any of the numbers.
For any two positive integers a and b, the product of their GCF and LCM equals the product of the two numbers: GCF(a, b) times LCM(a, b) equals a times b. This elegant relationship allows you to compute one value if you know the other. For example, if a equals 12 and b equals 18, then GCF is 6 and LCM is 36, and 6 times 36 equals 216 which is 12 times 18. This property only holds exactly for two numbers; for three or more numbers the relationship requires inclusion-exclusion adjustments.
The Euclidean algorithm is one of the oldest algorithms in mathematics, dating back over 2,300 years. It works by repeatedly dividing the larger number by the smaller one and replacing the larger number with the remainder. The process continues until the remainder is zero, at which point the last non-zero remainder is the GCF. For example, to find GCF(48, 18): 48 divided by 18 gives remainder 12, then 18 divided by 12 gives remainder 6, then 12 divided by 6 gives remainder 0, so the GCF is 6. This algorithm is extremely efficient even for very large numbers.
To find the GCF using prime factorization, first break each number down into its prime factors. Then identify all the prime factors that appear in every number and take the lowest power of each shared prime. For example, 12 equals 2 squared times 3, and 18 equals 2 times 3 squared. The shared primes are 2 and 3. The lowest power of 2 is 1 and the lowest power of 3 is 1, so GCF equals 2 times 3 which is 6. This method is intuitive and works well for smaller numbers, though the Euclidean algorithm is faster for larger numbers.
GCF and LCM appear throughout mathematics and everyday life. The GCF is used to simplify fractions (divide numerator and denominator by their GCF), distribute items into equal groups, and tile floors with the largest possible square tiles. The LCM is used to find common denominators when adding fractions, synchronize repeating schedules (like when two buses will arrive together again), and determine gear ratios in mechanical engineering. In computer science, the GCF is fundamental to cryptographic algorithms like RSA.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

GCF: product of common prime factors with lowest exponents | LCM: product of all prime factors with highest exponents

For two numbers a and b: GCF(a,b) x LCM(a,b) = a x b. The GCF uses the Euclidean algorithm (repeated division), while the LCM can be derived from the GCF using LCM(a,b) = |a x b| / GCF(a,b).

Worked Examples

Example 1: GCF and LCM of Two Numbers

Problem: Find the GCF and LCM of 48 and 36.

Solution: Prime factorization: 48 = 2^4 x 3, 36 = 2^2 x 3^2\nGCF = 2^2 x 3 = 12 (take lowest powers of shared primes)\nLCM = 2^4 x 3^2 = 144 (take highest powers of all primes)\nVerification: GCF x LCM = 12 x 144 = 1,728 = 48 x 36

Result: GCF = 12 | LCM = 144

Example 2: GCF and LCM of Three Numbers

Problem: Find the GCF and LCM of 12, 18, and 24.

Solution: Prime factorizations: 12 = 2^2 x 3, 18 = 2 x 3^2, 24 = 2^3 x 3\nGCF: lowest powers of shared primes = 2^1 x 3^1 = 6\nLCM: highest powers of all primes = 2^3 x 3^2 = 72\nAll three numbers divide evenly into 72: 72/12=6, 72/18=4, 72/24=3

Result: GCF = 6 | LCM = 72

Frequently Asked Questions

What is the Greatest Common Factor (GCF)?

The Greatest Common Factor, also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more numbers without leaving a remainder. For example, the GCF of 12 and 18 is 6 because 6 is the largest number that divides both 12 and 18 evenly. Finding the GCF is essential in simplifying fractions, factoring polynomials, and solving problems in number theory. The Euclidean algorithm is the most efficient classical method for computing the GCF of two numbers.

What is the Least Common Multiple (LCM)?

The Least Common Multiple is the smallest positive integer that is divisible by each of the given numbers. For instance, the LCM of 4 and 6 is 12 because 12 is the smallest number that both 4 and 6 divide into evenly. The LCM is widely used when adding or subtracting fractions with different denominators, scheduling recurring events, and solving problems involving periodicity. You can compute the LCM using prime factorization by taking the highest power of each prime factor that appears in any of the numbers.

How are GCF and LCM related to each other?

For any two positive integers a and b, the product of their GCF and LCM equals the product of the two numbers: GCF(a, b) times LCM(a, b) equals a times b. This elegant relationship allows you to compute one value if you know the other. For example, if a equals 12 and b equals 18, then GCF is 6 and LCM is 36, and 6 times 36 equals 216 which is 12 times 18. This property only holds exactly for two numbers; for three or more numbers the relationship requires inclusion-exclusion adjustments.

How does the Euclidean algorithm find the GCF?

The Euclidean algorithm is one of the oldest algorithms in mathematics, dating back over 2,300 years. It works by repeatedly dividing the larger number by the smaller one and replacing the larger number with the remainder. The process continues until the remainder is zero, at which point the last non-zero remainder is the GCF. For example, to find GCF(48, 18): 48 divided by 18 gives remainder 12, then 18 divided by 12 gives remainder 6, then 12 divided by 6 gives remainder 0, so the GCF is 6. This algorithm is extremely efficient even for very large numbers.

How do you find the GCF using prime factorization?

To find the GCF using prime factorization, first break each number down into its prime factors. Then identify all the prime factors that appear in every number and take the lowest power of each shared prime. For example, 12 equals 2 squared times 3, and 18 equals 2 times 3 squared. The shared primes are 2 and 3. The lowest power of 2 is 1 and the lowest power of 3 is 1, so GCF equals 2 times 3 which is 6. This method is intuitive and works well for smaller numbers, though the Euclidean algorithm is faster for larger numbers.

What are practical applications of GCF and LCM?

GCF and LCM appear throughout mathematics and everyday life. The GCF is used to simplify fractions (divide numerator and denominator by their GCF), distribute items into equal groups, and tile floors with the largest possible square tiles. The LCM is used to find common denominators when adding fractions, synchronize repeating schedules (like when two buses will arrive together again), and determine gear ratios in mechanical engineering. In computer science, the GCF is fundamental to cryptographic algorithms like RSA.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy