GCD and LCM Calculator
Enter two or more whole numbers to find their greatest common divisor and least common multiple, with the prime factorization of each, updated as you type.
Enter two or more whole numbers, separated by commas, spaces, or new lines. Everything is calculated in your browser. Nothing is uploaded.
Parsed 3 integers
How to find the GCD and LCM of numbers
Enter your integers
Type or paste two or more whole numbers into the box, separated by commas, spaces, or new lines.
Read the results
The greatest common divisor and least common multiple appear at once, along with the prime factorization of every number.
Switch notation and copy
Show each factorization as prime powers or fully expanded, then copy the full summary to your clipboard with one click.
Why use this tool
GCD and LCM together
The greatest common divisor and least common multiple are folded across your whole list, not just a single pair of numbers.
Prime factorization of each number
Every value is broken down into its prime factors, so you can see exactly why the GCD and LCM come out the way they do.
Handles negatives and zero
Negative numbers are compared by their absolute value, and zero follows the standard rules instead of throwing an error.
Powers or expanded notation
Display each factorization as compact prime powers or fully expanded, whichever reads better for your numbers.
Exact for large integers
Numbers with many digits stay precise, so the greatest common divisor and least common multiple are correct well beyond the point where an ordinary calculator loses accuracy.
Runs entirely in your browser
Everything happens on your device. The numbers you enter are never uploaded, stored, or logged.
About this tool
The GCD and LCM calculator takes a list of whole numbers and returns their greatest common divisor and least common multiple at the same time. The greatest common divisor, also called the greatest common factor or highest common factor, is the largest number that divides every value with no remainder. The least common multiple is the smallest positive number that every value divides into evenly. Enter your integers separated by commas, spaces, or new lines and both results update instantly as you type.
To make the answers easy to trust, the calculator also shows the prime factorization of each number. The greatest common divisor is the product of the prime factors shared by every value, and the least common multiple is the product of the highest power of each prime that appears anywhere in the list, so seeing the factorizations side by side makes the results clear. You can display each factorization as compact prime powers or fully expanded, whichever is easier to read.
Negative numbers are compared by their absolute value, and zero follows the usual convention, where the least common multiple of any list that contains zero is zero. Reach for this tool when you are reducing fractions, finding a common denominator, simplifying ratios, or working through number theory homework. The fraction calculator uses the same greatest common divisor to reduce a fraction to its lowest terms, and the exponent calculator helps when you evaluate the prime powers by hand. Everything runs in your browser, and nothing you enter is uploaded.
Frequently asked questions
- What is the difference between the GCD and the LCM?
- The greatest common divisor is the largest number that divides every value with no remainder, so it is never larger than the smallest input. The least common multiple is the smallest positive number that every value divides into, so it is never smaller than the largest input. This tool shows both at once.
- Is the GCD the same as the GCF or HCF?
- Yes. Greatest common divisor, greatest common factor (GCF), and highest common factor (HCF) are three names for the same value: the largest whole number that divides each of your inputs exactly.
- How does it handle negative numbers and zero?
- Negative numbers are compared by their absolute value, which is the standard convention, so the sign does not change the answer. The greatest common divisor of a value and zero is that value, and the least common multiple of any list that includes zero is zero.
- Can it find the GCD and LCM of more than two numbers?
- Yes. Enter as many integers as you like. The greatest common divisor and least common multiple are calculated one pair at a time across the whole list, which gives the correct result for any number of values.
- What counts as a valid number?
- Whole numbers only. Decimals, fractions, and anything that is not an integer are rejected and flagged, because the greatest common divisor and least common multiple are defined for integers. Numbers can be positive, negative, or zero.
- Is my data uploaded anywhere?
- No. Everything runs in your browser; nothing is sent to a server. The numbers you enter are never uploaded, stored, or logged.
Related tools
Fraction Calculator
Add, subtract, multiply, or divide two fractions and read the result as a simplified fraction, a decimal, and a mixed number, live as you type.
Exponent Calculator
Raise any base to a power and get the result, its expanded form, scientific notation, and roots, updated as you type.
Ratio Calculator
Reduce a ratio to lowest terms, or solve a proportion for the one value you are missing.
401(k) Calculator
Project your 401(k) balance at retirement from your contributions, employer match, and expected return, year by year.
Amortization Schedule Calculator
Build a full payment-by-payment schedule for any fixed-rate loan, with the payoff date and the interest you save by paying extra.
APY Calculator
Turn a nominal rate and compounding frequency into the true annual percentage yield, project a balance, or reverse solve the rate.