GCD and LCM

Compute the greatest common divisor (GCD) and least common multiple (LCM) of two numbers, simplifying fractions and ratios. GDPR-compliant.

How useful is this tool?

The result will appear here …

How to use this tool (video)

This video is hosted on YouTube. When you play it, data may be sent to Google.

GCD and LCM: The Greatest Common Divisor and Least Common Multiple

When comparing two numbers, you often encounter terms that were learned in school but rarely applied in daily life. The greatest common divisor, or GCD, is the largest number that divides both numbers without a remainder. The least common multiple, or LCM, is the smallest number that both original numbers divide into without a remainder. Our tool calculates both at a glance and helps you simplify fractions, reduce ratios, and solve math problems efficiently.

How it works

The GCD of two numbers is found by listing all divisors or by using the Euclidean algorithm. The Euclidean algorithm is especially efficient: you divide the larger number by the smaller one, take the remainder, and repeat the process with the remainder and the smaller number until the remainder is zero. The last non-zero remainder is the GCD. For example, the GCD of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 evenly. The LCM is calculated by dividing the product of the two numbers by the GCD. For 12 and 18, that is 12 times 18 divided by 6, which gives 36. To illustrate: the multiples of 12 are 12, 24, 36, 48, and the multiples of 18 are 18, 36, 54. The smallest common multiple is 36.

What the tool can and cannot do

The tool takes two integers as input and computes both the GCD and the LCM. It shows the calculation steps and the result clearly. What it cannot do is simplify three or more numbers simultaneously or find common divisors of more than two values. It is also not designed to perform prime factorizations or solve more complex number theory problems. It is a pure two-number tool for GCD and LCM.

Why local processing in the browser

Computing the GCD and LCM is pure arithmetic that requires no server. When the tool runs locally in your browser, your numbers stay on your device. There is no data transmission to a server, and a poor internet connection will not cause anything to fail. Once the page has loaded, the tool works offline as well, because all computations happen directly on your device. You can enter as many number pairs as you like without anything being stored or transmitted.

Creative uses

  • Fraction arithmetic: When adding or subtracting fractions, you need a common denominator. The LCM helps you find the least common denominator, and the GCD helps with simplifying.
  • Interior planning: When planning shelves or furniture where you need even spacing, the GCD can help find the optimal division.
  • Shopping and quantities: When buying items in different package sizes, the LCM helps determine the smallest uniform quantity you can order.
  • Music and rhythm: In music theory, GCD and LCM are used to synchronize simultaneous rhythms or time signatures.
  • Programming algorithms: The Euclidean algorithm is a building block of many computer science courses. The tool shows the steps and helps with learning.
  • Telecommunications: Frequency planning and scheduling use LCM calculations to avoid overlaps and coordinate cycles.

A small contribution to climate action

Every online request sent to a server consumes energy for data transmission and computation. Estimates suggest a single web page view produces about 1.76 grams of CO2, and the International Energy Agency reported in 2025 that data centers consumed about 415 terawatt-hours in 2024, roughly 1.5 percent of global demand. By computing GCD and LCM locally in your browser, you avoid a server request. Your data stays on your device, the network is conserved, and the result is the same.

Frequently asked questions

What is the greatest common divisor?

The greatest common divisor, or GCD, is the largest number that divides two or more numbers without a remainder. For example, the GCD of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 evenly. The GCD is commonly used for simplifying fractions.

What is the least common multiple?

The least common multiple, or LCM, is the smallest number that both original numbers divide into without a remainder. For 12 and 18, the LCM is 36. You calculate it by dividing the product of the two numbers by the GCD: 12 times 18 divided by 6 equals 36.

Do I need to be online for this?

No, not necessarily. Once the page has loaded, the tool works offline too. All calculations run locally in your browser, not on a server. A spotty connection will not interrupt you.

Will my data be uploaded?

No. The numbers you enter stay on your device. There is no transmission to a server, no storage, and no access by third parties. Computing GCD and LCM is pure arithmetic that your browser executes directly.

Can this tool handle more than two numbers?

No, this tool is limited to exactly two numbers. It computes the GCD and LCM for a pair of integers. For more than two numbers, you would need to use the tool multiple times or apply a different method.

How does the tool calculate the GCD?

The tool uses the Euclidean algorithm, one of the oldest and most efficient methods for finding the GCD. It repeatedly divides the larger number by the smaller one, using the remainder as the new smaller number until the remainder is zero. The last non-zero remainder is the GCD.

Are my data saved?

No. Everything happens locally in your browser. Nothing is sent to or stored on a server. You can close the page and reopen it, and your input will be gone, but the tool works instantly again.