Skip to content
Quasar Tools Logo

GCD & LCM Calculator

Calculate the Greatest Common Divisor and Least Common Multiple of two or more numbers instantly with our free GCD & LCM calculator. Enter any set of positive integers to get the GCD and LCM with prime factorizations, a step-by-step Euclidean algorithm breakdown, and divisibility verification. No signup required — all calculations run locally in your browser.

Calculate GCD & LCM

Enter two or more positive integers separated by commas or spaces. The GCD & LCM calculator instantly computes the Greatest Common Divisor and Least Common Multiple, shows prime factorizations, and displays a step-by-step Euclidean algorithm breakdown for two-number inputs. All calculations run locally in your browser.

Quick Examples:
48, 18GCD = 6, LCM = 144
12, 18, 24GCD = 6, LCM = 72
100, 75GCD = 25, LCM = 300
7, 13GCD = 1, LCM = 91 (coprime)

Why Use Our GCD & LCM Calculator?

Instant GCD & LCM Calculations

Calculate the Greatest Common Divisor and Least Common Multiple of two or more numbers instantly in your browser. Our GCD & LCM calculator delivers accurate results with prime factorizations in milliseconds.

Secure GCD & LCM Calculator Online

All GCD and LCM calculations happen locally in your browser — your numbers never leave your device. Use our GCD & LCM calculator online with complete privacy and zero data collection.

GCD & LCM Calculator Online — No Installation

Use our GCD & LCM calculator directly in any browser with no downloads, plugins, or app installs required. Calculate GCD and LCM from any device, anywhere, instantly.

Step-by-Step Euclidean Algorithm

Our GCD & LCM calculator shows a full step-by-step Euclidean algorithm breakdown for two-number inputs, plus prime factorizations and divisibility verification for all inputs — perfect for learning and checking your work.

Common Use Cases for GCD & LCM Calculator

Simplifying Fractions

The GCD is the key to reducing fractions to their lowest terms. Divide both the numerator and denominator by their GCD to get the simplest form — our GCD & LCM calculator makes this instant for any fraction.

Finding Common Denominators

Adding or subtracting fractions requires a common denominator, which is the LCM of the denominators. Use our GCD & LCM calculator to find the least common denominator for any set of fractions instantly.

Scheduling & Repeating Events

The LCM tells you when two or more repeating events will next coincide. Use our GCD & LCM calculator to find when buses on different schedules will arrive together, or when two machines with different cycle times will sync.

Math Homework & Exam Prep

Students use our GCD & LCM calculator to check homework answers and understand the Euclidean algorithm. The step-by-step breakdown shows exactly how the GCD is derived, making it a powerful learning tool.

Cryptography & Number Theory

GCD calculations are fundamental to RSA encryption and modular arithmetic. Developers and mathematicians use our GCD & LCM calculator to verify coprimality and compute modular inverses in number theory problems.

Tiling & Grid Problems

The GCD determines the largest square tile that can perfectly cover a rectangular floor without cutting. Use our GCD & LCM calculator for geometry, tiling, and grid-alignment problems in design and engineering.

Understanding GCD and LCM

What are GCD and LCM?

The Greatest Common Divisor (GCD) — also called the Greatest Common Factor (GCF) or Highest Common Factor (HCF) — is the largest positive integer that divides all given numbers without a remainder. For example, the GCD of 48 and 18 is 6, because 6 is the largest number that divides both evenly. The Least Common Multiple (LCM) is the smallest positive integer that is divisible by all given numbers. The LCM of 48 and 18 is 144. GCD and LCM are fundamentally linked by the relationship GCD(a, b) × LCM(a, b) = a × bfor any two positive integers. Our GCD & LCM calculator uses this relationship and the Euclidean algorithm to compute both values accurately for any set of numbers.

How Our GCD & LCM Calculator Works

  1. 1. Enter Your Numbers: Type two or more positive integers separated by commas or spaces. The GCD & LCM calculator accepts any integers from 1 to 1,000,000,000. All processing happens locally in your browser — your data never leaves your device.
  2. 2. Instant Calculation: Click "Calculate GCD & LCM" and the tool instantly computes the GCD using the Euclidean algorithm and the LCM using the GCD relationship. For two-number inputs, a full step-by-step Euclidean algorithm table is shown.
  3. 3. Review Results: View the GCD and LCM values, prime factorizations for each input number, and a divisibility verification table confirming the results are correct.

Calculation Methods

  • Euclidean Algorithm (GCD): The most efficient method for computing GCD. Repeatedly replace the larger number with the remainder of dividing the larger by the smaller until the remainder is 0. The last non-zero remainder is the GCD. For example: GCD(48, 18) → 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0 → GCD = 6.
  • LCM via GCD: LCM(a, b) = |a × b| ÷ GCD(a, b). This avoids computing prime factorizations and is efficient for large numbers. For multiple numbers, the GCD and LCM are computed iteratively: GCD(a, b, c) = GCD(GCD(a, b), c).
  • Prime Factorization Method: The GCD takes the minimum exponent of each shared prime factor; the LCM takes the maximum exponent of each prime factor across all numbers. Our calculator displays the prime factorization of each input for educational reference.
  • Coprime Numbers: Two numbers are coprime (relatively prime) when their GCD equals 1. In this case, their LCM equals their product. Our GCD & LCM calculator identifies coprime pairs automatically.

GCD vs LCM: Key Differences

The GCD is used when you need to reduce or divide — simplifying fractions, finding the largest common tile size, or splitting items into equal groups. The LCM is used when you need to combine or synchronize — finding common denominators, scheduling repeating events, or determining when cycles align. Both values are always positive integers, and for any two numbers a and b, GCD(a, b) always divides LCM(a, b).

Frequently Asked Questions About GCD & LCM Calculator

What is a GCD & LCM calculator?

A GCD & LCM calculator computes the Greatest Common Divisor (largest number dividing all inputs) and the Least Common Multiple (smallest number divisible by all inputs) for any set of integers. Our calculator also shows prime factorizations and a step-by-step Euclidean algorithm breakdown.

What is the difference between GCD and LCM?

The GCD is the largest number that divides all given numbers without a remainder — used for simplifying fractions and splitting into equal groups. The LCM is the smallest number divisible by all given numbers — used for finding common denominators and synchronizing repeating events.

How do I calculate GCD using the Euclidean algorithm?

Divide the larger number by the smaller and take the remainder. Replace the larger number with the smaller, and the smaller with the remainder. Repeat until the remainder is 0 — the last non-zero remainder is the GCD. Our GCD & LCM calculator shows every step of this process for two-number inputs.

Can I calculate GCD and LCM for more than two numbers?

Yes! Enter any number of integers separated by commas or spaces. The GCD & LCM calculator computes the result iteratively — GCD(a, b, c) = GCD(GCD(a, b), c) — handling any quantity of inputs accurately.

What does it mean when the GCD is 1?

When the GCD of two or more numbers is 1, the numbers are called coprime or relatively prime. This means they share no common factors other than 1. In this case, the LCM equals the product of all the numbers.

What is the relationship between GCD and LCM?

For any two positive integers a and b: GCD(a, b) × LCM(a, b) = a × b. This means if you know the GCD, you can compute the LCM as (a × b) ÷ GCD(a, b). Our GCD & LCM calculator uses this relationship for efficient computation.

Is this GCD & LCM calculator free to use?

Yes! Our GCD & LCM calculator is 100% free with no signup, no ads, and no usage limits. Calculate GCD and LCM as many times as you need — completely free, forever.

Is my data safe when using this GCD & LCM calculator?

Absolutely. All GCD and LCM calculations happen locally in your browser using JavaScript. Your numbers are never sent to any server, ensuring complete privacy every time you use our GCD & LCM calculator online.

What is the maximum number size supported?

Our GCD & LCM calculator supports positive integers up to 1,000,000,000 (one billion). For very large inputs, the LCM may exceed JavaScript's safe integer range — the calculator detects this and shows an error message.