Math

GCD & LCM Calculator

Find the greatest common divisor and least common multiple of two whole numbers instantly. Free GCD and LCM calculator.

Calculator

How it works

Enter two whole numbers greater than zero.

Privacy Local calculations
Most tools run directly in your browser. Your entered values are not sent to this Worker.

Browse all tools

About the GCD & LCM Calculator

Find the greatest common divisor (GCD) and least common multiple (LCM) of two whole numbers. They are useful for fractions, ratios and scheduling.

How to use it

Enter two whole numbers greater than zero. The tool uses the Euclidean algorithm and returns the GCD and LCM.

Formula

LCM = a × b ÷ GCD

Worked example

For 24 and 36, the GCD is 12 and the LCM is 72.

Understanding your result

The GCD is the largest number that divides both values. The LCM is the smallest number that both values divide into.

When it is useful

Common mistake

Entering decimals or zero. Both values must be positive whole numbers.

Two numbers, two questions

The GCD asks "what is the biggest number that divides both of these?" and the LCM asks "what is the smallest number both numbers divide into?" They are mirror problems on the same pair, and the arithmetic identity between them — LCM = a × b ÷ GCD — is what keeps both honest: for 24 and 36, GCD 12 and LCM 72 satisfy 24 × 36 ÷ 12 = 72 exactly. This page runs the Euclidean algorithm on the pair, the two-thousand-year-old shortcut that finds the GCD with a chain of remainders and needs no factoring at all.

The pair's usefulness is practical more than decorative. Simplifying 36/24 to lowest terms needs the GCD: divide top and bottom by 12 and you get 3/2, reduced in one move. Finding when two repeating schedules coincide needs the LCM: a 24-day cycle and a 36-day cycle land together every 72 days and never sooner. Fractions in a denominators discussion need both at once — and the cute fact that LCM of denominators can be smaller than their product only when they share a common factor, which is exactly the GCD's territory.

A worked example, step by step

Problem: a café restocks milk every 24 days and candles every 36 days; both arrived on the same date. When do they next coincide, and are the cycles shareable for a single combined order cycle?

  1. GCD first: 36 = 1 × 24 + 12, and 24 = 2 × 12 + 0. The last non-zero remainder is 12.
  2. GCD(24, 36) = 12, so the two cycles are far from coprime — they repeat a lot of ground in common.
  3. LCM: 24 × 36 ÷ 12 = 864 ÷ 12 = 72. Both schedules land together every 72 days.
  4. Simplify the ratio 24 : 36 by the GCD: 24 ÷ 12 = 2 and 36 ÷ 12 = 3, so the ratio is 2 : 3.
  5. Check with the identity: 24 × 36 ÷ 12 = 72 ✓.

The café's answer is "every 72 days" — but the deeper read is that GCD 12 says each cycle splits into 3 and 4 equal phases, so a 12-day pedal point underlies both. If a third delivery cycle showed up, its GCD with 72 would govern whether the trio ever aligns at all.

Common pairs at a glance

PairGCDLCMNote
8 and 12424Sharing a factor shortens both answers
10 and 15530Both multiples of 5 collapse quickly
21 and 28784Shares exactly one prime, 7
16 and 24848Powers of 2 dominate
9 and 15345Both multiples of 3
12 and 18636Denominator pairing examples
7 and 13191Coprime: LCM is the plain product
16 and 9911,584Coprime with a big product LCM
48 and 18012720Larger pair, same method

The coprime rows are the boundary case worth internalising: when the GCD is 1, the LCM is simply the product, nothing collapses, and no simplification is possible — the pair carries no common structure at all.

Where each one shows up

Simplifying fractions is the textbook use, and the one you will perform most: reduce by the GCD before any other operation so the arithmetic stays small. Building a common denominator for 1/24 + 1/36 uses the LCM — 72, because 24 × 3 = 72 and 36 × 2 = 72 — so the sum is 3/72 + 2/72 = 5/72. Syncing recurring events (restocks, maintenance intervals, round-robin duty rosters) asks the LCM of the cycle lengths. Cropping images or patterns from a grid uses the GCD of the dimensions to find the largest tile that tiles both sides exactly. None of these requires touching a factoring tool first; the Euclidean loop on this page finishes both answers in the same breath.

Mistakes that quietly wrong a GCD or LCM

  • Entering decimals or zeros. The tool rejects them for good reason: Euclid's algorithm only terminates exactly on positive integers.
  • Assuming the LCM equals the product. That is only true for coprime pairs; 24 × 36 = 864 is safe for neither fraction nor scheduling use.
  • Simplifying twice. After dividing by the GCD once, the numerator and denominator are coprime — a second "reduction" finds GCD 1 and changes nothing.
  • Swapping the roles. GCD answers "what divides both"; LCM answers "what both divide". Reading 72 as a divisor of 24 is the fastest way to nonsense.
  • Forgetting the overflow guard. Very large pairs can produce an LCM above safe integer size; the tool refuses those rather than returning a silent approximation.

Keep exploring

Frequently asked questions

What does coprime mean?

Two numbers are coprime when their only common factor is 1, so their GCD is 1.

How do I use the LCM with fractions?

The LCM of the denominators is the smallest common denominator when adding fractions.

What is the GCD of 24 and 36, and why 12?

Euclid's algorithm: 36 = 1 × 24 + 12, then 24 = 2 × 12 + 0. The last non-zero remainder is 12, so GCD = 12 and LCM = 24 × 36 ÷ 12 = 72.

How does the LCM help with fractions?

For 1/24 + 1/36 the LCM of the denominators is 72, not their product 864: the sum is 3/72 + 2/72 = 5/72, already reduced.

When are two numbers coprime, and what changes?

GCD 1 means nothing divides both, so the LCM is simply the product — like 7 × 13 = 91 — and no simplification is possible anywhere in the pair.

Can the tool handle very large numbers?

It stays exact for typical document-sized inputs and refuses pairs whose LCM would not fit in a safe integer, rather than printing a silent approximation.

Related guides

Page reviewed 21 October 2026. Results are estimates for general information. See the methodology and disclaimer.

Browse more tools

Percentage Calculator

Calculate a percentage of any number.

Math

What Percent Is X of Y?

Find what percentage one number is of another.

Math

Percentage Change

Calculate the percentage increase or decrease.

Math

Discount Calculator

Find the sale price after a discount.

Math

VAT Calculator

Add VAT to a net price or extract VAT from a gross price.

Finance

Tip Calculator

Calculate a tip and the total bill.

Finance

Bill Splitter

Split a bill among people, including a tip.

Finance

Average Calculator

Calculate the average of a list of numbers.

Math

Ratio Simplifier

Simplify a ratio of two numbers.

Math

Compound Interest Calculator

Estimate investment growth with compound interest.

Finance

Simple Interest Calculator

Calculate interest without compounding.

Finance

Loan Payment Calculator

Estimate monthly repayments on a fixed-rate loan.

Finance

Savings Goal Calculator

Estimate monthly savings needed to reach a target.

Finance

ROI Calculator

Calculate return on investment.

Finance

Profit Margin Calculator

Calculate profit and profit margin from revenue and costs.

Finance

Markup Calculator

Calculate selling price from cost and markup.

Finance

Currency Converter

Convert currencies using a rate you supply.

Conversions

BMI Calculator

Estimate body mass index from height and weight.

Health

Daily Calorie Estimate

Estimate daily energy needs using the Mifflin–St Jeor equation.

Health

Water Intake Estimator

Estimate a daily water baseline by body weight.

Health

Age Calculator

Calculate age from a date of birth.

Dates

Date Difference

Find the number of days between two dates.

Dates

Add Days to a Date

Find a date a chosen number of days from a start date.

Dates

Length Converter

Convert between common length units.

Conversions

Weight Converter

Convert mass and weight units.

Conversions

Temperature Converter

Convert Celsius, Fahrenheit and Kelvin.

Conversions

Speed Converter

Convert speed between km/h, mph and m/s.

Conversions

Volume Converter

Convert litres, millilitres, gallons and cups.

Conversions

Area Converter

Convert square metres, hectares, acres and more.

Conversions

Data Storage Converter

Convert bytes, kilobytes, megabytes and gigabytes.

Conversions

Word Counter

Count words, characters and sentences.

Text

Text Case Converter

Convert text to uppercase, lowercase or title case.

Text

Password Generator

Generate a random password in your browser.

Utilities

Unix Timestamp Converter

Convert a Unix timestamp into a readable date.

Dates

Character Limit Checker

Check text against a character limit.

Text

BMI Calculator (Imperial)

Estimate BMI using pounds and inches.

Health

Fuel Economy Converter

Convert between L/100 km, km/L and US mpg.

Conversions

Break-even Calculator

Estimate units needed to cover fixed costs.

Finance

Statistics Calculator

Mean, median, mode, range and standard deviation.

Math

GCD & LCM Calculator

Find the greatest common divisor and least common multiple.

Math

Unit Price Comparison

Compare two products to find the better price per unit.

Finance

Sales Tax Calculator

Add sales tax to a price or find the tax in a total.

Finance

Hourly to Salary Calculator

Convert an hourly wage to weekly, monthly and yearly pay.

Finance

Running Pace Calculator

Work out your pace per km and per mile.

Health

Working Days Calculator

Count weekdays between two dates.

Dates

Days Until a Date

Count the days to or since a date.

Dates

Random Number Generator

Pick random whole numbers in a range.

Utilities

CAGR Calculator

Find the steady yearly growth rate between two values.

Finance

Inflation Calculator

See how inflation changes prices and purchasing power.

Finance

Electricity Cost Calculator

Estimate what an appliance costs to run.

Finance

Weighted Grade Calculator

Weighted average of scores, and the final exam score you need.

Math

Rule of Three Calculator

Solve direct and inverse proportion problems.

Math

Fraction Simplifier

Simplify a fraction and see it as a decimal and a percent.

Math

Roman Numeral Converter

Convert numbers to Roman numerals and back.

Conversions

Number Base Converter

Convert between decimal, binary, octal and hexadecimal.

Conversions

Number to Words

Write a number in English words.

Text

Due Date Calculator

Estimate a due date from the last period.

Dates

Time Duration Calculator

Hours between two times, minus a break.

Dates

Week Number Calculator

ISO week number, day of year and quarter for a date.

Dates

Mortgage Calculator

Estimate the monthly payment of a home loan.

Finance

Loan Affordability Calculator

Find the loan size a monthly payment can support.

Finance

Savings Growth Calculator

See savings grow with deposits and interest.

Finance

Credit Card Payoff Calculator

See how long a card balance takes to clear.

Finance

Percentage Points Calculator

Difference between two percentages in points.

Math

Probability Calculator

Chance of one outcome and of at least one success.

Math

Odds to Probability Calculator

Turn odds like 3 to 1 into probabilities.

Math

Dice Roller

Roll up to 20 dice with any number of sides.

Utilities

Time Card Calculator

Add up a run of shifts and count the pay.

Dates

Sleep Calculator

Plan bedtimes or wake-up times in sleep cycles.

Health

Square Footage Calculator

Area of a rectangle in m², ft² and yd².

Conversions

Paint Quantity Calculator

How much paint a wall needs, coats included.

Utilities

Body Fat Estimate (US Navy Method)

Tape-measure body fat percentage estimate.

Health

Ideal Weight Calculator

Weight ranges from classic formulas and BMI.

Health

Fuel Cost Calculator

What a trip costs in fuel.

Finance

Concrete Calculator

Estimate concrete volume for a slab, with wastage.

Utilities

Tile Calculator

Work out how many tiles a floor or wall needs.

Utilities

Wallpaper Calculator

Estimate rolls of wallpaper for a room.

Utilities

Gravel Calculator

Convert area and depth into tonnes of gravel.

Utilities

Overtime Pay Calculator

Add up regular pay and overtime in one go.

Finance

Calories Burned Calculator

Estimate calories burned for an activity.

Health

Macro Calculator

Split daily calories into protein, carbs and fat.

Health

Miles to Steps

Convert between distance and footsteps.

Health

Test Score Percentage

Turn points earned into a percentage score.

Math

Stacked Discounts

See the real total of several discounts in a row.

Math

Pocket cheat sheets

Numbers worth remembering

Guides and explainers

All guides →

Show your working

Every tool lists its formula and a worked example, so you can verify the answer yourself.

Understand the result

Each page explains how to read the result, when to use it and the mistakes to avoid.

Clear limits

Estimates are labelled as estimates. Read how we work on the methodology page.

Free online tools for everyday tasks

Use the tools above for everyday calculations, conversions, planning and text processing. Check your inputs before relying on results for financial, medical or other important decisions.

Financial estimates are illustrative and may exclude fees, taxes or other costs. Health-related estimates are not medical advice. See the disclaimer.