Opus Calculator

    Type to search. Press ? for keyboard shortcuts.

    Keyboard shortcuts

    / Ctrl K
    Search and commands
    ?
    This list
    t
    Switch light or dark
    c
    Copy the result
    s
    Share the result
    r
    Clear all changes
    h
    Go to the home page

    GCD and LCM Calculator

    With the default inputs, the greatest common divisor comes to 6.

    Share this calculator

    GCD and LCM Calculator

    These are plain links: nothing is sent to those sites until you choose one.

    Find this useful?Add Opus Calculator as a preferred source on Google (opens in a new tab)

    Cite this calculator

    Pick a style, then copy. Dated by when this page was last updated.

    Citing your own numbers? Use "Share result" on the calculator.

    Embed this calculator

    Show it on your own page. It links back here and is not indexed by search engines.

    Use this calculator with AI

    An assistant connected to our MCP server runs the same exact calculation as this page and cites it.

    This prompt uses the calculator's default numbers. Change the inputs and it follows.

    2. Connect once

    The server is read-only, needs no account and stores nothing. Any client that supports remote MCP servers over HTTP can use it.

    3. Or give an agent this page in a machine-readable form

    Nothing has changed yet.

    Result

    Greatest common divisor: 6. Least common multiple: 144. Euclidean steps: 3

    Exact decimal arithmetic

    The formula

    Euclid: gcd(a, b) = gcd(b, a mod b) until the remainder is zero. lcm(a, b) = a × b ÷ gcd(a, b).

    Worked example

    gcd(48, 18): 48 = 2 × 18 + 12; 18 = 1 × 12 + 6; 12 = 2 × 6 + 0, so the gcd is 6 and the lcm is 48 × 18 ÷ 6 = 144.

    About this calculator

    The greatest common divisor of two whole numbers is the largest number that divides both exactly, and the least common multiple is the smallest number that both divide into. They are linked: multiplying the two numbers gives the product of their GCD and LCM. The GCD reduces fractions to lowest terms, and the LCM finds a common denominator or the time when two repeating cycles line up again. The calculator uses the Euclidean algorithm, which repeatedly replaces the larger number by the remainder. Worked scenarios, each run through the same calculator: 48 and 18 gives greatest common divisor 6, least common multiple 144, euclidean steps 3; 17 and 5 gives greatest common divisor 1, least common multiple 85, euclidean steps 3; 84 and 126 gives greatest common divisor 42, least common multiple 252, euclidean steps 3; 1071 and 462 gives greatest common divisor 21, least common multiple 23562, euclidean steps 3; 100 and 75 gives greatest common divisor 25, least common multiple 300, euclidean steps 2; 221 and 91 gives greatest common divisor 13, least common multiple 1547, euclidean steps 3; 360 and 252 gives greatest common divisor 36, least common multiple 2520, euclidean steps 3; 13 and 169 gives greatest common divisor 13, least common multiple 169, euclidean steps 2.

    Sources and method

    Every number is worked out with exact decimal arithmetic, not floating point, and rounded only when it is shown.

    Sources

    • 10.6 Introduction to Factoring Polynomials (Prealgebra 2e) · OpenStax, Rice University, checked . The greatest common factor of numbers by prime factorization, with the example that the GCF of 24 and 36 is 12. The calculator uses the Euclidean algorithm, which this page does not describe; it gives the same result.
    • 2.5 Prime Factorization and the Least Common Multiple (Prealgebra 2e) · OpenStax, Rice University, checked . The least common multiple by the prime factors method (find the prime factorizations, match primes in columns, bring down each column, multiply). The formula lcm = a x b / gcd is not stated on this page.

    Frequently asked questions

    Is GCD the same as GCF or HCF?

    Yes. Greatest common factor and highest common factor are other names for the greatest common divisor.

    What if the numbers share no factors?

    The GCD is 1 and they are called coprime; the LCM is their product.

    How do I find the GCD of three numbers?

    Take the GCD of the first two, then the GCD of that result with the third.