Skip to main content
CalculoraCalculora

Financial & Business

Finance CalculatorsInvestment & PlanningPersonal FinanceReal Estate InvestingBusiness ToolsStartup & SaaS

Math & Technology

Math CalculatorsEngineering ToolsPhysics ToolsDeveloper ToolsSchool Tools

Health & Life

Medical ToolsSmart UtilityRandomizers

Creator & Specialty

Creator EconomyIslamic ToolsSustainabilityGames

Converters

Unit ConverterLength ConverterWeight ConverterTemperature Converter→ Unit Converters

Randomizers

Random Number GeneratorPassword Strength CheckerSpin the WheelCoin Flip SimulatorDice RollerTimezone Overlap Calculator→ Randomizers
File Converter

PDF Tools

Convert PDF to JPGConvert PDF to PNGConvert PDF to TXTConvert PDF to GIFConvert PDF to WebPConvert PDF to SVGConvert PDF to DOCXConvert PDF to XLSXConvert PDF to PPTXConvert PDF to HTMLConvert PDF to MarkdownConvert PDF to TIFF

Image Converter

Convert JPG to PNGConvert PNG to JPGConvert PNG to WebPConvert WebP to PNGConvert WebP to JPGConvert JPG to WebPConvert SVG to PNGConvert SVG to JPGConvert SVG to WebPConvert BMP to PNGConvert BMP to JPGConvert BMP to WebP

Advanced Images

Convert HEIC to JPGConvert HEIC to PNGConvert TIFF to JPGConvert TIFF to PNGConvert JPG to TIFFConvert PNG to TIFFConvert JPG to ICOConvert PNG to ICOConvert JPEG to AVIFConvert PNG to AVIF

GIF & Animation

Convert GIF to PNGConvert GIF to JPGConvert GIF to individual frames (PNG/JPEG)Convert PNG to GIFConvert JPG to GIFConvert GIF to WebP

Editing

Convert any image to watermarked imageConvert any image to cleaned imageResize images instantly in your browserCompress images online — reduce file size, keep quality
Math Speed ChallengeMental Math ChallengeWordleBint WaladSudoku2048
Currency Converter
CalculoraCalculora

Your all-in-one calculator platform. Free, fast, and accurate tools for every need.

Calculator inputs stay 100% private — all math happens in your browser and never touches our serversFree forever — no paywalls, no subscriptions, no accounts needed

Popular

  • BMI Calculator
  • Loan Calculator
  • Age Calculator
  • Mortgage Calculator
  • Percentage Calculator
  • Scientific Calculator

Math

  • Statistics Calculator
  • Equation Solver
  • Fraction Calculator
  • Prime Factorization Calculator
  • GCD & LCM Calculator
  • Logarithm Calculator

Finance

  • FIRE Calculator
  • Debt Snowball Calculator
  • Investment Calculator
  • Retirement Calculator
  • Salary Calculator
  • ROI Calculator

Legal

  • View All
  • Categories
  • Currency Converter
  • Sitemap
  • Games & Fun Tools
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Disclaimer

Languages

  • enEnglish
  • arالعربية
  • esEspañol
  • deDeutsch
  • frFrançais
  • hiहिन्दी
  • idBahasa Indonesia
  • itItaliano
  • ja日本語
  • ko한국어
  • ptPortuguês
  • ruРусский
  • trTürkçe
  • viTiếng Việt
  • bnবাংলা
  • zh中文
  • nlNederlands
  • plPolski
  • ukУкраїнська
  • msBahasa Melayu
  • thภาษาไทย

© 2026 Calculora. All rights reserved.

Built with — 100% free

Lightweight & fast — cookies and analytics run only with your consent

  1. Home
  2. Math Calculators
  3. GCD & LCM Calculator

GCD & LCM Calculator

Find the Greatest Common Divisor and Least Common Multiple of two or more numbers, with the full Euclidean algorithm laid out step by step — not just the final answer.

What is GCD & LCM Calculator?

The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) are two of the most important concepts in elementary number theory, with applications from simplifying fractions in middle school to cryptographic algorithms that secure the internet.

The Euclidean algorithm, described by Euclid around 300 BC, is one of the oldest and most efficient algorithms in mathematics. It computes the GCD in O(log(min(a,b))) steps, terminating rapidly even for very large numbers. The algorithm applies the identity: GCD(a, b) = GCD(b, a mod b) repeatedly until the remainder is zero.

This calculator shows the complete Euclidean algorithm step by step for two numbers, and also computes GCD and LCM for lists of multiple numbers using the generalization: GCD(a, b, c) = GCD(GCD(a, b), c).

Formula

Euclidean Algorithm:
GCD(a, b) = GCD(b, a mod b) until b = 0
 
LCM from GCD:
LCM(a, b) = |a × b| / GCD(a, b)
 
For multiple numbers:
GCD(a, b, c) = GCD(GCD(a, b), c)
LCM(a, b, c) = LCM(LCM(a, b), c)

How to Calculate

  1. Enter two positive integers a and b.
  2. Apply integer division: a = q×b + r.
  3. Replace a with b and b with r. Repeat until r = 0.
  4. The last non-zero remainder is the GCD.
  5. Compute LCM = |a × b| / GCD using the fundamental identity.
  6. Use Multiple Numbers mode for three or more numbers.

Example

Find GCD(48, 18): 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0. GCD = 6. LCM = |48×18|/6 = 864/6 = 144. Check: 144/48 = 3 ✓, 144/18 = 8 ✓.

Key Terms Explained

GCD
Largest integer dividing both numbers without remainder
LCM
Smallest positive integer divisible by both numbers
Co-prime
Two numbers with GCD = 1, sharing no common prime factors
Euclidean algorithm
Ancient algorithm computing GCD by repeated division
Modulo operation
a mod b is the remainder when a is divided by b
Divisibility
a divides b if b/a has no remainder

Common Use Cases

  • Simplifying fractions: reduce a/b by dividing both by GCD(a, b)
  • Adding fractions with different denominators: find LCM of denominators
  • Scheduling: finding when two recurring events will next coincide
  • RSA key generation: checking that exponent e is co-prime with φ(n)
  • Gear ratio problems in mechanical engineering
  • Tile pattern design: finding the smallest repeating unit

Frequently Asked Questions

What is GCD and how is it calculated?
GCD (Greatest Common Divisor) is the largest positive integer that divides both a and b without remainder. The Euclidean algorithm computes it efficiently: repeatedly replace (a, b) with (b, a mod b) until b = 0. The last non-zero value is the GCD.
What is LCM and what is it used for?
LCM (Least Common Multiple) is the smallest positive integer divisible by both a and b. It is used for adding fractions with different denominators, scheduling problems, and music theory.
What is the relationship between GCD and LCM?
GCD(a, b) × LCM(a, b) = |a × b|. Once you know the GCD, the LCM is simply |a × b| / GCD(a, b). This is more efficient than listing multiples.
What does co-prime mean?
Two numbers are co-prime (relatively prime) if their GCD is 1 — they share no common prime factors. Co-primality is fundamental in modular arithmetic, cryptography, and the Chinese Remainder Theorem.

Related Tools

Percentage Calculator
Scientific Calculator
Fraction Calculator
Exponents Calculator
Matrix Calculator
Equation Solver
GCD (Greatest Common Divisor)
6
LCM (Least Common Multiple)
144
Co-prime?
No
48 = GCD × ?
6 × 8
18 = GCD × ?
6 × 3
Euclidean Algorithm — Step by Step
1

Apply the Euclidean algorithm to find GCD(48, 18)

2

Division steps (Euclidean algorithm)

48 = 2 × 18 + 12 → 18 = 1 × 12 + 6 → 12 = 2 × 6 + 0

✓

GCD(48, 18) = last non-zero remainder

4

LCM = |a × b| / GCD

✓

LCM(48, 18)

Key Properties

• GCD(a, b) × LCM(a, b) = |a × b|

• GCD(a, 0) = a (any number is divisible by itself)

• If GCD(a, b) = 1, then a and b are co-prime (relatively prime)

• The Euclidean algorithm runs in O(log(min(a,b))) time

• LCM is used for adding fractions with different denominators