GCD & LCM Calculator

Greatest common divisor and least common multiple, with steps you can follow.

GCD Calculator
LCM Calculator
Euclidean Algorithm
Prime Factorization

GCD & LCM Calculator

Calculate Greatest Common Divisor (GCD) and Least Common Multiple (LCM) with detailed explanations

Quick Examples

GCD vs LCM

GCD

Largest positive integer that divides all inputs with no remainder. GCD(12, 18) = 6.

  • GCD(a, 0) = |a|
  • If GCD(a, b) = 1, a and b are coprime
  • GCD(a, b) × LCM(a, b) = |a × b| for two numbers

LCM

Smallest positive integer that every input divides into evenly. LCM(12, 18) = 36.

  • LCM(a, b) = |a × b| / GCD(a, b)
  • If a divides b, LCM(a, b) = |b|
  • Useful for fraction denominators and repeating schedules

How to compute them

Euclidean algorithm (GCD): replace the larger number with the remainder of division until the remainder is 0. The last non-zero remainder is the GCD. Example: GCD(48, 18) → 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0 → GCD = 6.

Prime factors: for GCD take the lowest power of each shared prime; for LCM take the highest power of each prime that appears. Fast enough for small numbers; Euclidean wins for large ones.

More than two numbers: GCD(a, b, c) = GCD(GCD(a, b), c). Same pattern for LCM.

Frequently Asked Questions

What's the difference between GCD and LCM?

GCD is the biggest shared divisor. LCM is the smallest shared multiple. GCD is at most the smallest input; LCM is at least the largest.

Why is GCD × LCM = a × b?

For two numbers, the shared primes appear once in the GCD and at their highest powers in the LCM. Together they match the primes in a × b.

Euclidean or prime factorization?

Euclidean for speed on large integers. Factorization when you want to see the primes or teach the structure.

What about negative numbers?

Work with absolute values. Results are reported as positive by convention.

What does GCD = 1 mean?

The numbers are coprime (no shared factor other than 1). Then LCM(a, b) = |a × b|.

Any shortcuts?

Consecutive integers are always coprime. If one divides the other, GCD is the smaller and LCM is the larger.

Related tools

Related tools

Related Number Tools

Fibonacci Sequence Generator - Golden Ratio Analysis Tool

Generate Fibonacci sequences with customizable starting values. Explore golden ratio convergence, mathematical properties, and sequence analysis with detailed statistics.

Find Maximum Number - Largest Value Finder Online

Find the maximum number in your dataset instantly. Track positions, analyze occurrences, and get detailed statistics. Free online maximum value finder.

Find Minimum Number - Smallest Value Finder Online

Find the minimum number in your dataset instantly. Track positions, analyze occurrences, and get detailed statistics. Free online minimum value finder.

Fraction to Decimal Converter - Convert Fractions with Long Division Steps

Convert fractions to decimals with step-by-step long division. Learn about terminating and repeating decimals, mixed numbers, and decimal representations.

Frequency Table Generator

Create comprehensive frequency distribution tables for categorical and numerical data. Calculate relative frequencies, percentages, cumulative statistics, and mode analysis for statistical research.

Hexadecimal to Decimal Converter - Convert Hex to Dec Online

Convert hexadecimal numbers to decimal and vice versa instantly. Perfect for programming, web development, and computer science. Free online hex-dec converter.

Histogram Generator - Create Frequency Distribution Charts Online

Generate professional histograms from numerical data. Visualize frequency distributions, calculate statistics, and export charts. Perfect for data analysis and statistics.

Integer Checker - Validate & Identify Integer Numbers Online

Free online integer checker tool to validate and identify integer numbers. Check if numbers are integers, whole numbers, or natural numbers with detailed explanations.

Interest Calculator

Calculate simple and compound interest with detailed breakdowns. Perfect for loans, investments, savings, and financial planning with year-by-year analysis.

Leading/Trailing Zeros Remover

Remove unnecessary leading and trailing zeros from numbers while preserving mathematical value. Clean up data, normalize numbers, and improve readability.