U.UtilityApp
🔢 MathFree · No signup

LCM & GCF Calculator

Find the least common multiple (LCM) and greatest common factor (GCF/HCF) of two numbers.

How the two results are worked out

The GCF (greatest common factor, also called HCF) is the largest whole number that divides both of yours. The LCM (least common multiple) is the smallest number that both divide into. The defaults, 12 and 18, give a GCF of 6 and an LCM of 36.

The calculator finds the GCF with the Euclidean algorithm, repeatedly dividing and keeping the remainder:

  1. 18 ÷ 12 = 1, remainder 6
  2. 12 ÷ 6 = 2, remainder 0, so the GCF is 6

Then it uses LCM = a × b ÷ GCF: 12 × 18 ÷ 6 = 36. That shortcut is why the two answers always multiply back to the product of your numbers.

Decimals, negatives and zero

You enterTreated asLCMGCF
4.5 and 65 and 6301
−12 and 1812 and 18366
0 and 50 and 505

Decimals are rounded to the nearest whole number without a warning, so 4.5 quietly becomes 5. LCM and GCF are only defined for whole numbers. If you're working with fractions or decimals, scale them to whole numbers first. Minus signs are dropped, since the answers are always positive.

Where each one is useful

  • Adding fractions (LCM): for 5/12 + 7/18, the LCM of the denominators is 36. Rewrite as 15/36 + 14/36 = 29/36.
  • Repeating schedules (LCM): if one bus leaves every 12 minutes and another every 18, and both leave now, they next leave together in 36 minutes.
  • Simplifying fractions (GCF): 48/180 has a GCF of 12, so it reduces to 4/15.
  • Equal tiles or groups (GCF): the largest square tile that covers a 240 cm × 180 cm area without cutting is 60 cm, laid 4 by 3.

Three or more numbers

The calculator takes two numbers at a time, but you can chain it. For 8, 12 and 15:

  1. Enter 8 and 12: LCM 24, GCF 4.
  2. Enter 24 and 15 to get the overall LCM: 120.
  3. Enter 4 and 15 to get the overall GCF: 1.

A GCF of 1 means the numbers share no factor other than 1. In that case, for two numbers, the LCM is simply their product: 7 and 9 give 63.

A limit with very large numbers

The calculator stores numbers in the browser's standard floating-point format, which counts whole numbers exactly only up to 9,007,199,254,740,992. An LCM above that may be wrong in the last digits. For 123,456,789 and 987,654,321 it shows 13,548,070,123,626,140, while the exact LCM ends in 141. The GCF of 9 is still correct. For numbers that size, use software with big-integer support.

Frequently asked questions

Are GCF, HCF and GCD the same thing?+

Yes. Greatest common factor, highest common factor and greatest common divisor are three names for the same number. Which one you see depends mostly on the textbook or country.

Can the LCM be smaller than one of the numbers?+

No. The LCM is always at least as large as the bigger number. It equals the bigger number when the smaller one divides it exactly, as with 6 and 24, whose LCM is 24 and GCF is 6.

How do I find the LCM using prime factors?+

Factor both numbers and take each prime at its highest power. 12 is 2 × 2 × 3 and 18 is 2 × 3 × 3, so the LCM uses two 2s and two 3s: 36. For the GCF, take each shared prime at its lowest power: one 2 and one 3, which is 6.

Embed this tool on your website

Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.

<iframe src="https://utilityapp.lat/embed/math/lcm-calculator" title="LCM & GCF Calculator" width="100%" height="660" style="border:0;max-width:760px" loading="lazy"></iframe>
<p style="font-size:13px"><a href="https://utilityapp.lat/math/lcm-calculator">LCM & GCF Calculator</a> by UtilityApp</p>