GCF and LCM Calculator
MathFind the GCF (HCF) and LCM of any two numbers instantly using prime factorisation, with step-by-step working and factor breakdown shown in full.
Reviewed by the thecalcu.com team · Last updated July 19, 2026
GCF (HCF)
Greatest Common Factor / Highest Common Factor
LCM
Lowest Common Multiple
What is a GCF & LCM?
The GCF & LCM Calculator (also known as HCF and LCM Calculator in Indian school notation) computes both the Greatest Common Factor and the Least Common Multiple of any two positive integers simultaneously. It also displays the complete prime factorisation of each input as individual factor chips with exponents, and verifies the result using the identity GCF × LCM = a × b.
GCF (Greatest Common Factor), also called HCF (Highest Common Factor) or GCD (Greatest Common Divisor), is the largest integer that divides both numbers exactly. LCM (Least Common Multiple) is the smallest positive integer that is divisible by both numbers. While these are taught as separate topics in school, they are intimately related: for any two numbers a and b, GCF(a, b) × LCM(a, b) = a × b. This calculator exploits that relationship to compute both in a single pass using the efficient Euclidean algorithm for GCF, then derives LCM from it.
In Indian mathematics education, HCF and LCM are introduced in Classes 5–6 under the chapter "Playing with Numbers" and revisited in Class 10 (Real Numbers chapter) where the Euclidean algorithm and prime factorisation method are formalised. Beyond school, these concepts appear whenever you need to divide things into equal groups without leftovers (GCF), or find the first point where two periodic processes coincide (LCM).
The Prime Factorization Calculator is a natural companion to this tool, if you want a deep exploration of a single number's factor tree, that calculator gives you the full prime breakdown with divisor count and primality check.
Why Use a GCF & LCM Calculator?
For small numbers (under 20), GCF and LCM are easy to compute mentally or by listing factors. For larger numbers like 252 and 360, listing all factors becomes error-prone and slow. The Euclidean algorithm is efficient but requires careful tracking of remainders across several division steps. A single arithmetic slip produces a wrong GCF, which then cascades into a wrong LCM.
This calculator eliminates that arithmetic burden and adds two important extras. First, the prime factorisation chips let you see why the GCF and LCM have the values they do, the GCF is built from shared prime factors (minimum exponents), and the LCM from all prime factors (maximum exponents). This makes the result educationally meaningful rather than just a number. Second, the verification check GCF × LCM = a × b gives immediate confirmation that both results are correct and consistent.
For Class 10 CBSE students, this is particularly useful for the type of problem that gives GCF and LCM and asks for the original numbers, the relationship GCF × LCM = a × b plus the constraint a/GCF and b/GCF are coprime are the key tools.
Who Should Use This Calculator?
Class 5–6 students learning HCF and LCM for the first time. Seeing the prime factor chips alongside the HCF and LCM makes the prime factorisation method visual and easier to understand than a text-only explanation.
Class 10 students preparing for CBSE board examinations where the Real Numbers chapter requires GCF and LCM calculations using the Euclidean algorithm. Quick verification of multi-step division sequences prevents careless errors.
Engineering and competitive exam aspirants (JEE Foundation, CAT, GMAT) where HCF-LCM problems in word-problem form are common. Problems like "two tasks complete in X and Y minutes, when do they coincide?" translate directly to LCM calculations.
Teachers and tutors who want to explain the prime factorisation method visually. The factor chips showing 2³ × 3² × 5 for each number make it easy to identify common factors and pick minimum/maximum exponents.
Software developers who need to compute GCD for implementing modular arithmetic, cryptographic algorithms (RSA key generation uses GCD), or fraction simplification in number-parsing code. The Prime Factorization Calculator is a complementary tool for deeper number theory needs.
What Insights Does the GCF & LCM Calculator Give You?
GCF (HCF), the primary result. This is the largest number that divides both inputs with zero remainder. A GCF of 1 means the two numbers are coprime (no common factors other than 1), for example, GCF(7, 13) = 1 since both are prime. A large GCF relative to the inputs means they share many factors, for example, GCF(48, 72) = 24, which means both numbers are divisible by 2, 3, and 4 among others.
LCM, the secondary result. This is the smallest number that both inputs divide into exactly. Large LCMs relative to the inputs indicate the numbers share few common factors. If LCM equals a × b, the GCF is 1 (the numbers are coprime).
Prime Factorisation Chips, each chip shows a prime base and its exponent (e.g., "2³", "5²") for both input numbers. To find GCF from the chips: take each prime that appears in both numbers, use the lower exponent. To find LCM from the chips: take each prime that appears in either number, use the higher exponent.
Verification: GCF × LCM = a × b, displayed as a green confirmation card. This is a mathematical identity, not an approximation, if this equality holds, both GCF and LCM values are guaranteed to be correct. If you're computing by hand and get a GCF × LCM ≠ a × b, one of your intermediate steps contains an error.
How to use this GCF & LCM calculator
Enter Number A, type the first positive integer. Accepts whole numbers from 1 upwards. Negative numbers and decimals are not supported (GCF/LCM are defined for positive integers).
Enter Number B, type the second positive integer. The two numbers can be equal (in which case GCF = LCM = the number itself), or one can be a multiple of the other.
Read GCF, the primary result card shows the Greatest Common Factor. This is the answer to "what is the HCF of a and b?" in CBSE notation.
Read LCM, the secondary result card shows the Least Common Multiple. This is the answer to "what is the LCM of a and b?" and the answer to "when do these two periodic events first coincide?" type problems.
Examine Prime Factor Chips, the factor chips for each number show the complete prime factorisation. Identify which primes are shared and how the minimum/maximum exponent rule produces the GCF and LCM.
Verify GCF × LCM = a × b, the green verification card confirms both results are consistent and correct.
Formula & Methodology
Euclidean Algorithm (for GCF):GCF(a, b) = GCF(b, a mod b), repeating until remainder = 0Last non-zero remainder = GCF LCM from GCF:LCM(a, b) = (a × b) / GCF(a, b) Prime Factorisation method (alternative):GCF = product of common primes, each to the minimum exponentLCM = product of all primes, each to the maximum exponent Verification identity:GCF(a, b) × LCM(a, b) = a × b Worked example, CBSE Class 10 style problem: Find the HCF and LCM of 252 and 360 using the prime factorisation method. Step 1, Factorise both numbers:252 = 2² × 3² × 7360 = 2³ × 3² × 5 Step 2, HCF (minimum exponents of common primes):Common primes: 2 (min of 2 and 3 = 2) and 3 (min of 2 and 2 = 2)HCF = 2² × 3² = 4 × 9 = 36 Step 3, LCM (maximum exponents of all primes):All primes: 2 (max = 3), 3 (max = 2), 5 (max = 1), 7 (max = 1)LCM = 2³ × 3² × 5 × 7 = 8 × 9 × 5 × 7 = 2,520 Step 4, Verify: HCF × LCM = 36 × 2,520 = 90,720 = 252 × 360 = 90,720 ✓ Assumption: GCF and LCM are defined for positive integers only. Entering 0 is treated as undefined (most implementations return the other number for GCF(0, n) = n by convention, but this calculator requires both inputs to be positive integers ≥ 1).
Frequently Asked Questions