Toolvore

LCM & GCF Calculator

Find the lowest common multiple and greatest common factor of any set of numbers.

This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.

This finds the lowest common multiple and the greatest common factor of any list of whole numbers, and shows the prime factorisation of each one so the answer can be checked rather than taken on trust.

How to use it

  1. 1Type two or more whole numbers, separated by commas, spaces or anything else.
  2. 2The LCM and GCF appear immediately, each with a copy button.
  3. 3Read the working underneath to see how each number breaks into primes.

Example

Input
12, 18, 30
Output
LCM 180, GCF 6 — from 12 = 2^2 × 3, 18 = 2 × 3^2, 30 = 2 × 3 × 5

The GCF takes the lowest power of each shared prime; the LCM takes the highest power of every prime present.

What happens to your data

This tool runs entirely in your browser. Your input is never uploaded to a server, never stored, and never logged. The arithmetic is done with BigInt in this tab.

Last updated August 2026

The lowest common multiple and the greatest common factor usually arrive together, because the questions that need one tend to need the other. Adding 1/6 and 1/8 needs their LCM, 24, as a common denominator. Cutting 1071/462 down to its simplest form needs their GCF, 21, which turns it into 51/22. A delivery that repeats every 12 days and a stock count that repeats every 18 land on the same day every 36.

Enter as many numbers as the question actually has — two, or ten — and the answers stay exact however large they get. Nothing is rounded on the way through, so a 28-digit LCM comes out with all 28 digits. The one thing to watch is that only digits count: a decimal point or a minus sign is read as a separator rather than as part of a number, which is why the line of working that names the numbers it actually used is worth a glance.\n\nThe names differ by country and by textbook, which is half the confusion: an HCF calculator and a GCD calculator compute the same thing as a GCF calculator, and LCM and HCF are usually taught together because one is found from the other. This does the least common multiple and the greatest common factor side by side for exactly that reason \u2014 seeing both makes the relationship between them visible instead of something to memorise. One LCM calculator that also shows the factor saves running two.

How it works

Toolvore finds the GCF with Euclid's algorithm — divide one number by the other, replace the pair with the divisor and the remainder, and stop when the remainder is zero — then takes the LCM from it by dividing one number by that GCF before multiplying by the other, so the intermediate value never grows past the answer. A longer list is folded through both operations a pair at a time. Every value is held as a BigInt rather than an ordinary JavaScript number, which is the whole reason the large answers can be trusted: the same Euclid loop run in floating point on 12345678901234567890 and 9876543210987654321 reports a GCF of 2048, a number that divides neither of them, where this returns 90000000009. The prime factorisation shown underneath is trial division, so it has limits the LCM and GCF do not. Nothing you type is uploaded or stored; the arithmetic happens in the tab. The numbers do go into the address bar as you type, so Share hands over a link that reopens the same answer — though a value longer than 120 characters, roughly thirty two-digit numbers, is ignored when that link is opened and the page falls back to its default 12, 18, 30.

Common use cases

  • Finding a common denominator before adding or comparing fractions — 1/6 and 1/8 meet at 24
  • Reducing a fraction to its lowest terms — 1071/462 divides through by 21 to give 51/22
  • Checking homework, with each number broken into primes to hold your own working against
  • Working out when two repeating cycles coincide — every 12 days and every 18 days meet every 36
  • Simplifying a ratio whose numbers are well past the point ordinary calculator arithmetic stays exact

Frequently asked questions

How do I find the LCM of three or more numbers?

Type them all into the one box, separated however you like — commas, spaces, semicolons, dashes, slashes. Anything that is not a digit is treated as a separator. The list is folded a pair at a time, so 4, 6 and 21 give an LCM of 84 and a GCF of 1, and both figures update as you type rather than waiting for a button. There is no limit on how many numbers you enter, though only the first eight get a line of working.

Is HCF the same thing as GCF?

Yes. Greatest common factor, highest common factor and greatest common divisor are three names for one number: the largest whole number that divides every number in the set. British schools usually say HCF, American ones GCF, and programming libraries tend to say GCD — Python's function is math.gcd. This labels it GCF, and the answer is the same whichever name you were taught. For 1071 and 462 it is 21.

Can I enter decimals, fractions or negative numbers?

No, and it is worth knowing exactly how they fail rather than assuming they went through. Anything that is not a digit is treated as a separator, so 2.5, 4 is read as three numbers — 2, 5 and 4, giving an LCM of 20 — and -12 is read as 12. Zero is dropped, and with only one number left you get an error rather than an answer. LCM and GCF are defined for whole numbers only, so refusing is right, but the refusal is quiet: the working line names the numbers it actually used, and that is the line to check. If you are adding fractions, enter the denominators on their own.

How large can the numbers be?

Larger than you are likely to need. Give it 12345678901234567890 and 9876543210987654321 and the GCF comes back as 90000000009 and the LCM as 1354807012498094801236261410 — 28 digits, every one of them correct. Ordinary JavaScript numbers, the default arithmetic in a browser, stop being able to hold every whole number past 9,007,199,254,740,991, about 9 quadrillion. Run the same method that way on those two values and it returns a GCF of 2048, which divides neither of them, and an LCM roughly 44 million times too big.

Why is there no working next to some of my numbers?

Two reasons, both deliberate. The factorisation list stops after the first eight numbers — enter 1 to 10 and you get the right LCM of 2520, which needs the 9, but only eight lines beneath it. And an individual number is left unfactored if it runs past eighteen digits, or if trial division passes a million without having broken it up: 1000036000099 is only thirteen digits, but its smallest factor is 1000003, so it reads "too large to factorise here" rather than grinding through half a million divisions to gain very little. The LCM and GCF are exact either way. Only the working is skipped.

If the GCF is 1, is the LCM just the numbers multiplied together?

Only when no two of them share a factor. 6, 10 and 15 have a GCF of 1, yet their LCM is 30 rather than 900, because each pair still shares something. The tool checks the pairs rather than the whole set and tells you which case you are in — for 6, 10 and 15 it says two of them still share a factor, so the LCM is less than their product.