Skip to content
CalculatorsRuns in your browser

GCF and LCM Calculator

Greatest common factor and least common multiple of two or more numbers — a GCF and LCM calculator in one page.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the GCF and LCM Calculator

Find the greatest common factor (GCF) and least common multiple (LCM) of two or more whole numbers, with the prime factorisation of each shown.

This GCF and LCM calculator finds the greatest common factor and least common multiple of any set of whole numbers. The greatest common factor and least common multiple are the two workhorses of fraction arithmetic. Enter any set of whole numbers and this calculator returns both, plus the prime factorisation of each input so you can see the shared factors directly.

What they mean

GCF(12, 18) = 6   → the largest number dividing both
LCM(12, 18) = 36  → the smallest number both divide into

For two numbers the identity GCF × LCM = a × b always holds — here 6 × 36 = 216 = 12 × 18.

How they are computed

The GCF uses Euclid's algorithm, repeatedly replacing the larger number by the remainder until one reaches zero. The LCM is then a × b ÷ GCF, extended across the whole list. Prime factorisation is shown for verification.

Worked example

The GCF and LCM of 48 and 180, by Euclid's algorithm:

180 = 3 × 48 + 36
 48 = 1 × 36 + 12
 36 = 3 × 12 + 0    → remainder zero, so GCF = 12
LCM = (48 ÷ 12) × 180 = 4 × 180 = 720

The identity GCF × LCM = a × b holds: 12 × 720 = 8,640 = 48 × 180. The prime factorisations agree as well — 48 = 2⁴ × 3 and 180 = 2² × 3² × 5, so the GCF takes the lowest power of each shared prime (2² × 3 = 12) and the LCM takes the highest (2⁴ × 3² × 5 = 720). Both routes reach the same pair, which is the check worth running when you are doing it on paper.

Why the LCM divides before it multiplies

The obvious formula is a × b ÷ GCF and it is mathematically identical. The implementation computes (a ÷ GCF) × b instead, dividing first. The reason is overflow: for two large numbers the product a × b can exceed what a 64-bit integer holds even when the LCM itself fits comfortably inside it, and the division-first ordering never produces that intermediate value.

The same care runs through the rest of the tool. Everything is exact integer arithmetic, so there is no rounding anywhere and no practical upper limit. Euclid's algorithm is also remarkably quick — its step count grows with the logarithm of the input rather than with the input itself, which is why two fifteen-digit numbers resolve instantly instead of visibly grinding.

What the two numbers are actually for

The LCM is the tool for adding fractions with unlike denominators: 1/6 + 1/8 needs a common denominator, and LCM(6, 8) = 24 is the smallest one that works. It also settles scheduling questions — two events repeating every 6 days and every 8 days coincide every 24 days.

The GCF is the tool for reducing fractions and for dividing things into equal groups. Twelve items and eighteen items can be split into groups of at most six with nothing left over, because GCF(12, 18) = 6. It is also the side length of the largest square that tiles a 12 × 18 rectangle exactly, and it is the basis of every simplification Fraction Calculator performs.

Both extend naturally beyond a pair: GCF(a, b, c) = GCF(GCF(a, b), c), and the LCM the same way, which is how this tool handles a whole list of inputs rather than only two. Ratio Calculator uses the identical GCF step to reduce a ratio to its lowest terms.

Private and instant

All of it runs in your browser with exact integer arithmetic. Nothing is uploaded.

Step by step

How to use the GCF and LCM Calculator

  1. Enter two or more whole numbers, separated by commas or spaces.

  2. Read the greatest common factor and the least common multiple.

  3. Check the prime factorisation table to see where they come from.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Two or more numbers

Not limited to a pair — add as many whole numbers as you like and the GCF and LCM are computed across all of them.

Prime factorisation shown

A table breaks each number into its prime factors, which makes the common factors and multiples easy to verify by hand.

Fast integer maths

Uses Euclid's algorithm, so even large numbers resolve instantly without rounding.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

What is the difference between GCF and LCM?

The GCF (greatest common factor) is the largest number that divides all the inputs evenly. The LCM (least common multiple) is the smallest number that all the inputs divide into. One is about sharing factors, the other about sharing multiples.

How do I find the LCM of fractions?

Add or subtract fractions by taking the LCM of their denominators as the common denominator. Find that LCM here, then use the fraction calculator to combine them.

Does GCF × LCM equal the product?

For two numbers, yes: GCF(a,b) × LCM(a,b) = a × b. That identity is a quick way to check your answer, and the calculator shows the product for you.