CraftTools

GCD & LCM Calculator

Guide: GCD, LCM and Fractions: How They Connect

Greatest common divisor (GCD)
6

The biggest number that divides all of them

Least common multiple (LCM)
144

The smallest number they all divide into

Prime factors

  • 48 = 2^4 × 3
  • 18 = 2 × 3^2

Euclid’s algorithm

Divide the bigger number by the smaller one, keep the remainder, and repeat until the remainder is 0. The last divisor is the GCD.

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

Nothing you enter or choose here leaves your device. This tool runs in your browser.

Two numbers, both answers

The greatest common divisor, also called the highest common factor, is the largest number that divides all your numbers exactly. The least common multiple is the smallest number that all of them divide into. For 48 and 18, the GCD is 6. For 4 and 6, the LCM is 12. You can enter two or more numbers, separated by commas or spaces.

How Euclid's method finds the GCD

The tool shows the steps. The idea, which is over two thousand years old, is to replace the pair with the smaller number and the remainder, and repeat until the remainder is zero. For 48 and 18:

48 = 18 x 2 + 12
18 = 12 x 1 + 6
12 = 6 x 2 + 0

The last non-zero remainder is 6, so the GCD is 6.

From GCD to LCM

For two numbers, the GCD times the LCM equals the two numbers multiplied together. So the LCM is the product divided by the GCD: 48 times 18 is 864, divided by 6 is 144. For more than two numbers, the tool works through them in pairs. The GCD of 12, 18 and 30 is 6, and the LCM of 4, 6 and 10 is 60.

Prime factors

Break each number into primes and the answers become visible. 360 is 2 cubed times 3 squared times 5. The GCD takes the smallest power of each shared prime, and the LCM takes the largest power of every prime. The tool shows prime factors for numbers up to about a trillion.

Where it's useful

ProblemUseExample
Simplify a fractionGCD48/18: divide both by 6 to get 8/3
Schedules that repeatLCMBuses every 12 and 18 minutes meet again every 36
Common denominatorLCM1/4 + 1/6: use 12
Cutting into equal piecesGCDLargest square tile for a 48 by 18 floor is 6
Sharing items evenlyGCD48 pens and 18 books fit into 6 equal packs

Special cases

  • If the GCD is 1, the numbers are coprime. They share no factor other than 1, and the LCM is their product.
  • If one number divides the other, the GCD is the smaller one and the LCM is the larger.
  • Zero is awkward. The GCD of a number and 0 is the number itself.
  • Negative numbers are treated by their size.

The numbers can be any size, since they're handled exactly. Nothing is sent anywhere. To use the result on fractions, try the fraction calculator, and the guide to GCD, LCM and fractions explains more of the ideas.

Written by Akinrinmade Michael · Updated October 24, 2026 · General information, not professional advice

How to use

  1. 1Type two or more whole numbers, separated by commas or spaces.
  2. 2Read the GCD and the LCM.
  3. 3Check the prime factors and the steps of Euclid's algorithm.

Frequently asked questions

What is the GCD?

The greatest common divisor, also called the highest common factor (HCF), is the largest number that divides all your numbers exactly. For 48 and 18 it is 6.

What is the LCM?

The least common multiple is the smallest number that all your numbers divide into exactly. For 4 and 6 it is 12.

How do GCD and LCM relate?

For two numbers, GCD x LCM equals the two numbers multiplied together. That is how the LCM is found from the GCD.

Can I use very large numbers?

Yes, the GCD and LCM work for numbers of any size. Prime factors are shown for numbers up to about a trillion.

Is my data sent anywhere?

No. Everything is worked out in your browser and nothing is sent to us.

Read the guide

Learn how this works and how to get the most from it.

Money, health & time

GCD, LCM and Fractions: How They Connect

How to find the greatest common divisor and least common multiple, and how they help you simplify and add fractions step by step.

3 min read

Fraction Calculator

Add, subtract, multiply and divide fractions and mixed numbers.

Mean, Median & Mode Calculator

Find the average, median, mode and range of any list of numbers.

Number Base Converter

Convert between binary, octal, decimal, hexadecimal and any base to 36.

Percentage Calculator

Find percentages, percentage change and percent increase or decrease.