Matheminate
TopicsProgressWorksheetsGamesToolsAbout
Loading math...
TopicsAboutPrivacyTermsContact

© 2026 Matheminate. All rights reserved.

← All math tools

GCF & LCM Calculator

Find the greatest common factor and least common multiple of two integers.

Calculations run on your device. No account needed.

Practice integers →

How to use this calculator

Enter two nonzero whole numbers and press Calculate. Read the greatest common factor (GCF), least common multiple (LCM), and the multiplication used to find the LCM; negative inputs are treated by their absolute values.

How the calculation works

The GCF is the largest positive number that divides both inputs without a remainder. The LCM is the smallest positive number that is a multiple of both. The calculator finds the GCF with repeated remainders, then uses LCM = (first number ÷ GCF) × second number.

Worked examples

  1. 1. Find common factors and multiples

    For 12 and 18, the greatest shared factor is 6. LCM = (12 ÷ 6) × 18 = 36, so 36 is the first positive number in both multiplication tables.

  2. 2. Compare coprime numbers

    For 8 and 15, no factor above 1 divides both, so the GCF is 1. LCM = (8 ÷ 1) × 15 = 120.

Frequently asked questions

Are GCF, GCD, and HCF the same thing?

Yes. Greatest common factor, greatest common divisor, and highest common factor name the same positive number.

How does the LCM help with fractions?

The LCM of two denominators is their least common denominator. For denominators 12 and 18, use 36 to rewrite both fractions before adding or subtracting.

Can I use decimals or zero?

No. This calculator requires nonzero safe integers. Negative inputs are accepted as absolute values, so −12 and 18 give the same results as 12 and 18.

Why do large inputs sometimes show an error?

Even safe integer inputs can produce an LCM outside JavaScript’s exact integer range. The calculator rejects that result rather than claiming an exact rounded number.

Keep learning with related tools

Use Prime Factorization to see the prime building blocks of each number, or the Fraction Calculator to apply common factors and denominators. The integers lesson builds the underlying number skills. Related tools: Prime Factorization Calculator, Fraction Calculator. Read the Integers & Negative Numbers lesson or practice integers & negative numbers to build confidence without relying on a calculator.