LCM and HCF Calculator

Type two or more whole numbers to get their LCM and HCF, with the working shown.

Whole numbers above 0, separated by commas or spaces. Up to 20 numbers, each up to 12 digits.
HCF / GCD
–
LCM
–

Prime factorization

    How it was worked out

    Your data stays in your browser

    This tool runs on JavaScript inside your browser. Nothing you add here is uploaded to our server, so it works for confidential data too. How we handle data

    • No upload
    • Processed on your device
    • No account

    How do I find the HCF and LCM using prime factors?

    Break each number into primes. For 12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The HCF uses only the primes found in every number, each at its lowest power: 2 × 3 = 6. The LCM uses every prime at its highest power: 2² × 3² × 5 = 180.

    What is the difference between LCM and HCF?

    The HCF is the biggest number that divides all of them exactly. The LCM is the smallest number that all of them divide into. Use the HCF to simplify fractions or split things into equal groups, and the LCM to add fractions or find when repeating events line up, like two buses that leave every 12 and 18 minutes meeting again after 36 minutes.

    Is there a shortcut for two numbers?

    Yes. For any two numbers, HCF × LCM = the two numbers multiplied together. So once you know the HCF of 12 and 18 is 6, the LCM is 12 × 18 ÷ 6 = 36. This rule doesn't work for three or more numbers.

    More maths help: the Quadratic Equation Solver works through the quadratic formula, the Mean, Median, Mode Calculator handles statistics, and the Online Calculator has powers, roots and factorials.

    Questions people ask

    Is HCF the same as GCD and GCF?

    Yes. Highest common factor, greatest common divisor and greatest common factor are three names for the same thing.

    What is the LCM of 12 and 18?

    36. The HCF is 6, and 6 × 36 = 216, which equals 12 × 18.

    What is the HCF of two prime numbers?

    1, because primes share no factors other than 1. Their LCM is the two primes multiplied together.

    How many numbers can I enter?

    Up to 20 whole numbers, each up to 12 digits long.

    Can I find the LCM of decimals or negative numbers?

    No. LCM and HCF are defined for positive whole numbers. For fractions, find the LCM of the denominators.

    Why is the HCF sometimes 1?

    When the numbers share no prime factor, like 8 and 15, the only common factor is 1. Such numbers are called co-prime.

    Related tools