HomeAll CategoriesGCF Calculator with Steps | Free Greatest Common Factor

GCF Calculator with Steps | Free Greatest Common Factor

GCF Calculator

Find the greatest common factor of two, three or fifty numbers, or of monomials and polynomials with variables and exponents, with every step shown. This greatest common factor calculator also factors out the GCF, gives the LCM, and checks each answer.

AlgebraStep by StepExact AnswerGCF and LCMPolynomialsFree

⚡ 0. Quick Answer

A GCF calculator finds the greatest common factor: the largest whole number that divides every number in a set with no remainder.

For 24 and 36, write the primes: 24 = 2³ × 3 and 36 = 2² × 3². Keep the shared primes at their lowest power: 2² × 3 = 12. So GCF(24, 36) = 12 and LCM(24, 36) = 72.

GCF(a, b) = GCF(b, a mod b)  ·  GCF × LCM = a × b

Rule of thumb: the GCF is never bigger than the smallest number. If the GCF is 1, the numbers are relatively prime and a fraction made from them is already in lowest terms.

Key Takeaways

  • This GCF calculator gives the greatest common factor of up to 50 numbers or 30 algebra terms, with every step.
  • For numbers, keep the primes shared by every number at their lowest power: GCF(24, 36) = 2² × 3 = 12.
  • For monomials, multiply the GCF of the coefficients by each shared letter at its lowest exponent: GCF(12x³y², 18x²y, 30xy⁴) = 6xy.
  • To factor out the GCF, divide every term by it and keep a 1 where a whole term cancels: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1).
  • For two numbers GCF × LCM = a × b, so 12 × 72 = 24 × 36 = 864. A GCF of 1 means the numbers are coprime.

📚 1. What Is a GCF Calculator?

The greatest common factor (GCF) of two or more whole numbers is the largest number that divides each of them exactly. It is also called the greatest common divisor (GCD) or the highest common factor (HCF). All three names mean the same thing.

A GCF calculator does this work for you and shows it. You type numbers such as 24, 36, or algebra terms such as 12x³y² + 18x²y − 30xy⁴, and it returns the exact GCF, the steps by four methods, the LCM, and a check that the answer is right.

What it is used for: simplifying fractions (24/36 = 2/3 after dividing by 12), splitting things into the largest equal groups, finding the biggest square tile for a floor, and the first step of factoring any polynomial.

A worked one-liner: GCF(24, 36): 36 = 1 × 24 + 12, then 24 = 2 × 12 + 0. The last non-zero remainder is 12.

Prime factor Venn diagram: GCF of 24 = 2 × 2 × 2 × 3 and 36 = 2 × 2 × 3 × 3 is 1224 = 2 × 2 × 2 × 336 = 2 × 2 × 3 × 32shared2 × 2 × 33GCF = 12 · LCM = 72
Prime factor Venn diagram for 24 and 36. The overlap (2 × 2 × 3 = 12) is the GCF. Everything in both circles (2 × 2 × 3 × 2 × 3 = 72) is the LCM.

Who uses it: students in Grades 4 to 9 meet the GCF with whole numbers, Grades 8 to 10 (Algebra 1, CBSE Class 10, IGCSE) use it to factor polynomials, teachers build answer keys with the batch tab, and programmers use Euclid's algorithm for fractions, ratios, screen aspect ratios and cryptography.

MethodHow it worksBest forWeak spot
Listing factorsWrite every factor of each number, pick the largest shared oneSmall numbers under 100Slow and easy to miss a factor
Prime factorizationShared primes at their lowest powerTwo or three numbers; also gives the LCMHard when a number has a large prime factor
Euclid's algorithmDivide, keep the remainder, repeat until 0Large numbers, computers, any sizeDoes not show the prime structure
Ladder (cake) methodDivide all numbers by a shared prime, repeatClassroom work with 2 to 4 numbersNeeds a shared prime at each step
Monomial ruleGCF of coefficients times shared letters at lowest powerAlgebra terms with variables and exponentsWhole-number coefficients only

🧮 2. Enter Your Numbers or Algebra Terms

Two to fifty whole numbers. Negatives and 0 are allowed (GCF uses absolute values). A fraction such as 24/36 is read as the two numbers 24 and 36, so you can simplify it. Numbers up to 200 digits are exact.

Type powers with ^ (x^3), or paste x² and x³. 4ab means 4 × a × b. Use whole-number coefficients and single letters. Example list: 12x^3y^2, 18x^2y, 30xy^4. Example polynomial: 6x^2 + 9x.

Teachers use this to build an answer key: paste up to 200 problems, press Solve, then Download Doc saves every answer with its working.

Nothing is calculated until you press Solve (or Enter). Changing the sample clears the results.

📊 3. Results and Step-by-Step Solution

Greatest common factor
___
Press Solve to see the exact GCF, the LCM and every step.

🧠 4. Understanding Your Answer, In Detail

___ Solve a problem above and this section fills with your own numbers.

4.1 What the GCF means

The GCF is the biggest number that "goes into" every number with nothing left over. If the GCF of 24 and 36 is 12, you can split 24 apples and 36 oranges into 12 identical bags, each with 2 apples and 3 oranges. No bigger number of identical bags is possible.

4.2 Why the quotients prove the answer

Divide each number by the GCF. For 24 and 36 you get 2 and 3. Those quotients share no factor except 1. If they shared a factor, say 2, then 2 × 12 = 24 would be a bigger common factor. This is the check the calculator runs on every answer.

4.3 A GCF of 1

When the GCF is 1, the numbers are relatively prime (coprime). They can both be composite: 35 = 5 × 7 and 64 = 2⁶ share no prime, so GCF(35, 64) = 1. A fraction such as 35/64 is already in lowest terms.

4.4 When the GCF equals one of the numbers

If the smallest number divides all the others, it is the GCF. GCF(12, 36, 60) = 12 because 36 and 60 are multiples of 12. Check this first; it saves time in exams.

4.5 The GCF of algebra terms

A monomial GCF has a number part and a letter part. The number part is the GCF of the coefficients. The letter part takes only letters found in every term, each at its lowest power. For 12x³y², 18x²y and 30xy⁴ the GCF is 6xy: 6 from the numbers, x¹ because the lowest power of x is 1, and y¹ because the lowest power of y is 1.

4.6 Negative signs

The GCF of numbers is always positive. In algebra, when the first term is negative, teachers usually want you to factor out the negative of the GCF so the bracket starts with a positive term: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1). The positive form 4ab(−2a² + 3ab − 1) is also correct.

4.7 How the GCF changes when one number changes

The GCF is very sensitive. GCF(24, 36) = 12, but GCF(24, 35) = 1 and GCF(24, 48) = 24. Changing one number by 1 can drop the GCF to 1, because consecutive numbers are always coprime.

4.8 What comes next

The GCF leads straight to the LCM (used to add fractions), to simplifying fractions and ratios, and to factoring polynomials by grouping, where you factor out a GCF from each pair of terms. Try the factor calculator to list every factor of one number, or the algebra calculator for the next step in factoring.

✍ 5. How to Write the Answer

▶ Solve a problem above to fill all five cards with your own answer.

1. Exam / homework answer (full working)
24 = 2^3 × 3, 36 = 2^2 × 3^2. Shared primes at lowest power: 2^2 × 3 = 12. Answer: GCF(24, 36) = 12
📌 Conventions
  • Show the prime factorization or the Euclid lines; a bare answer often scores 1 mark out of 3.
  • Box or underline the final answer.
  • Write GCF(a, b) = n, not just n.
2. Final answer only
GCF = ___
📌 Conventions
  • The GCF of numbers is a positive whole number, never a decimal.
  • For factoring, write the GCF outside the brackets.
3. Teacher's answer key line
GCF(___) = ___
📌 Conventions
  • Prime form in brackets helps students find their own error.
  • Use the Batch tab to make a whole key at once.
4. Report or project sentence
The greatest common factor of ___ was ___.
📌 Conventions
  • Name the method used (prime factorization or Euclid's algorithm).
  • Spell out "greatest common factor" the first time, then use GCF.
5. Plain text for a forum or chat
gcf(___) = ___
📌 Conventions
  • Use ^ for powers (x^3) so it pastes cleanly anywhere.
  • Keep a space around + and - between terms.

∑ 6. Formulas Used

①
GCF by Prime Factorization
GCF = p₁min(a₁, b₁) × p₂min(a₂, b₂) × …
p₁, p₂The primes that appear in the numbers
aᵢ, bᵢThe power of each prime in the first and second number (0 if missing)
minTake the smaller power; a prime missing from any number drops out
Example24 = 2³ × 3, 36 = 2² × 3² ⇒ 2² × 3¹ = 12
②
Euclid's Algorithm (c. 300 BC)
GCF(a, b) = GCF(b, a mod b),   GCF(a, 0) = a
a, bPositive whole numbers, a ≥ b
a mod bThe remainder when a is divided by b
StopWhen the remainder is 0; the last divisor is the GCF
Example36 = 1 × 24 + 12, 24 = 2 × 12 + 0 ⇒ 12
SpeedAt most about 5 times the number of digits of the smaller number (Lamé, 1844)
③
GCF of Three or More Numbers
GCF(a, b, c) = GCF(GCF(a, b), c)
a, b, cAny whole numbers, in any order
RuleFold the list one number at a time
ExampleGCF(48, 72, 120) = GCF(GCF(48, 72), 120) = GCF(24, 120) = 24
④
GCF of Monomials
GCF = GCF(c₁, c₂, …) × xmin(m₁, m₂, …) × ymin(n₁, n₂, …)
cᵢThe coefficient (number part) of term i, as a positive whole number
mᵢ, nᵢThe exponent of x and of y in term i (0 if the letter is missing)
RuleA letter missing from any term is left out of the GCF
Example12x³y², 18x²y, 30xy⁴ ⇒ 6 × x¹ × y¹ = 6xy
⑤
Factoring Out the GCF
a₁ + a₂ + … = G(a₁/G + a₂/G + …)
GThe GCF of all the terms (negative if the first term is negative and you choose that form)
aᵢ/GEach term divided by the GCF; subtract exponents when dividing letters
RuleA term equal to G becomes 1, not 0
Example12x³y² + 18x²y − 30xy⁴ = 6xy(2x²y + 3x − 5y³)
⑥
GCF and LCM Identity (two numbers)
GCF(a, b) × LCM(a, b) = a × b  ⇒  LCM = a × b ÷ GCF
LCMLeast common multiple, the smallest positive number both divide
RequiresExactly two non-zero numbers; for three or more this product rule fails
Example12 × 72 = 864 = 24 × 36
⑦
Check and Special Cases
G | aᵢ for every i,   GCF(aᵢ/G) = 1
G | aG divides a with remainder 0
GCF(0, n)= |n|, because every number divides 0
GCF(0, 0)Undefined (no greatest common divisor)
NegativesGCF(−a, b) = GCF(a, b); the GCF of numbers is positive
BézoutThere are whole numbers x, y with ax + by = GCF(a, b); for 24 and 36: 24(−1) + 36(1) = 12

🔀 7. GCF Flowchart, Step by Step

This GCF flowchart shows how to find the greatest common factor step by step, from two raw numbers to a checked answer. Every box uses the same worked example as Sections 0, 9, 10, 11 and 14: 24 and 36.

Start or resultData stepCalculation stepYes or no check
StartFind the GCF of two whole numbers24 and 36
CheckIs any number negative or 0?
No24 and 36 are both positive. Carry on.
YesDrop minus signs. Skip a 0, since GCF(0, n) = n. All zeros: stop, the GCF is undefined.
1
Break each number into primes24 = 2 × 2 × 2 × 3   36 = 2 × 2 × 3 × 324 = 2³ × 3, 36 = 2² × 3²
2
List the primes found in both numbers2 and 3 appear in both
CheckIs at least one prime shared?
Yes2 and 3 are shared. Carry on.
No, stopThe GCF is 1. The numbers are relatively prime.
3
Take each shared prime at its lowest powermin(3, 2) = 2 for prime 2,   min(1, 2) = 1 for prime 32² and 3¹
4
Multiply them2² × 3 = 4 × 3GCF = 12
5
Confirm with Euclid's algorithm36 = 1 × 24 + 12,   24 = 2 × 12 + 0Last non-zero remainder = 12
CheckDo the quotients share no factor but 1?
Yes24 ÷ 12 = 2 and 36 ÷ 12 = 3. GCF(2, 3) = 1, so 12 is the greatest.
No, stopA bigger common factor exists. Look for a prime you missed.
6
Use the same work for the LCMLCM = 24 × 36 ÷ 12LCM = 72
ResultGCF(24, 36) = 12Verified by division Euclid agreesLCM = 72, and 24/36 simplifies to 2/3.

Check any box yourself: =GCD(24,36) in Excel (Section 9), the R script in Section 10 and the Python script in Section 11 all return 12, and the by-hand method in Section 14 gets there with pencil and paper.

📝 8. How to Use This Calculator

  1. Pick a tab. Use Numbers for whole numbers, Monomials and Polynomials for algebra terms, or Batch for many problems at once.
  2. Type your problem. Separate numbers with commas, for example 24, 36. For algebra type 12x^3y^2 + 18x^2y - 30xy^4, or a comma list of monomials.
  3. Or load a sample problem. The Sample menu has 10 problems, from a textbook pair to a 19-digit pair, coprime numbers, 0 and 0, and a negative polynomial trap.
  4. Choose the methods to show. All methods shows prime factorization, Euclid, the ladder method and listing factors. Pick one if your teacher wants a specific method.
  5. Set the sign rule for algebra. Factor out a negative GCF when the first term is negative (the usual school form), or keep the GCF positive.
  6. Press Solve. Or press Enter. Nothing is computed before you do, so you never read an old answer.
  7. Read the answer box. It shows the exact GCF, the LCM, the GCF in prime form and a green Verified badge once the check passes.
  8. Follow the steps. Each step names its rule. Press Show key steps only for a short version you can copy into an exam answer.
  9. Look at the tables and charts. The Venn diagram, ladder table, Euclid table and four charts show why the GCF is what it is.
  10. Copy or download your working. Section 5 gives five ready answers to copy. Download Doc saves every step as text, and Download PDF prints the page.

📈 9. How to Find the GCF in Excel

Excel has a built-in GCD function, which is the same thing as the GCF. It takes up to 255 numbers or ranges, so one formula handles two, three or a whole column. Excel cannot factor algebra, but with three helper columns it finds the GCF of monomials too.

The whole thing in one line: with 24 in A2 and 36 in A3, type =GCD(A2:A3). Excel returns 12. =LCM(A2:A3) returns 72.

9.1 The functions you need

You wantExcel functionNote
GCF of numbers=GCD(A2:A10)Same as GCF and HCF; up to 255 arguments
LCM of numbers=LCM(A2:A10)Returns #NUM! if any value is negative
Remainder (Euclid step)=MOD(A2,B2)The a mod b in Euclid's algorithm
Whole-number quotient=QUOTIENT(A2,B2)Drops the remainder
Absolute value=ABS(A2)Wrap negatives before GCD
Lowest exponent=MIN(B2:B4)For the letter part of a monomial GCF
Simplified fraction=A2/GCD(A2,B2)&"/"&B2/GCD(A2,B2)Shows 2/3 for 24/36

9.2 Step by step

1 Put the numbers in one column

Type a header in A1 and the numbers below it. Here 24 is in A2 and 36 in A3.

Excel sheet with 24 and 36 entered in column Afx24ABC1Number224336

Column A holds 24 and 36, the worked example used on the whole page.

2 Type the GCD and LCM formulas

In B2 type =GCD(A2:A3) and in C2 type =LCM(A2:A3).

Excel GCD formula returning 12fx=GCD(A2:A3)ABC1NumberGCFLCM2241272336

Excel returns GCF = 12 and LCM = 72, the same as Sections 0 and 7.

3 Check the answer

In B2 type =A2/GCD($A$2:$A$3) and in C2 type =MOD(A2,GCD($A$2:$A$3)), then fill both down to row 3. In B4, =GCD(B2:B3) must give 1.

Excel checking quotients 2 and 3fx=GCD(B2:B3)ABC1NumberNumber/GCFRemainder22420336304GCF of quotients1

The quotients 2 and 3 have GCF 1 and both remainders are 0, so 12 is verified.

4 Show Euclid's algorithm (optional)

Put 36 in A2 and 24 in B2. In C2 type =MOD(A2,B2). In A3 type =B2, in B3 type =C2, and fill row 3 down until the remainder is 0.

Excel Euclid table for 36 and 24fx=MOD(A2,B2)ABC1abremainder23624123241204GCF12

The remainders go 12 then 0, so the GCF is the last divisor, 12. Teachers like this sheet because it shows the method.

5 GCF of monomials

Put each coefficient in column A and each power of x and y in columns B and C. Then =GCD(ABS(A2),ABS(A3),ABS(A4)), =MIN(B2:B4) and =MIN(C2:C4).

Excel monomial GCF with coefficient and exponent columnsfx=GCD(ABS(A2),ABS(A3),ABS(A4))ABC1coefpower of xpower of y21232318214-30145611

Row 5 reads 6, 1, 1, so the GCF of 12x³y², 18x²y and −30xy⁴ is 6xy. A letter with a 0 anywhere in its column is not in the GCF.

9.3 The awkward cases

  • Negative numbers: =GCD(-18,27) returns #NUM!. Use =GCD(ABS(A2),ABS(A3)), or in Excel 365 =GCD(ABS(A2:A10)).
  • Decimals: Excel quietly truncates them, so =GCD(2.9, 6) is treated as GCD(2, 6) = 2. Convert to whole numbers first.
  • Very large numbers: Excel stores 15 significant digits and GCD rejects values of 253 or more with #NUM!. Sample 5 in the calculator (19 digits, GCF 987,654,321) cannot be done in Excel; use this page, R with gmp, or Python.
  • Zeros: =GCD(0,36) gives 36, which is correct. =GCD(0,0) gives 0, but mathematically it is undefined.

9.4 Why Excel might disagree with R or Python

SituationWhat happensFix
A negative inputExcel: #NUM!. Python math.gcd(-18, 27) = 9Wrap with ABS in Excel
GCF(0, 0)Excel and Python return 0; mathematics says undefinedTreat 0 as "no answer"
Numbers above 253Excel: #NUM! or lost digits. Python integers are exact at any sizeUse Python, R gmp, or this calculator
Decimal inputsExcel truncates; Python math.gcd(2.5, 5) raises TypeErrorScale to whole numbers first
-3^2 typed in a cellExcel gives 9 because the minus binds first; R, Python and paper give −9Write =-(3^2). Matters when you square a coefficient
Base RHas no built-in gcd function at allUse the 6-line Euclid function in Section 10

9.5 Charting it in Excel

Select the prime column and the exponent columns for each number, then Insert, Clustered Column chart. Add a GCF column with =MIN(B2:C2) and colour it green, so the shared lowest powers stand out. Two fixes: set the vertical axis Major unit to 1 (exponents are whole numbers), and put primes on the horizontal axis as text, not numbers.

9.6 Excel errors you will probably hit

ErrorCauseFix
#NUM!A negative value, or a value of 253 or moreABS(), or switch tools for huge numbers
#VALUE!Text in the range, such as "24 cm"Keep only numbers in the cells
#NAME?Typed GCF( instead of GCD(The Excel name is GCD
#DIV/0!Dividing by a GCD that came out 0 (all cells empty or 0)Check the range has a non-zero number
#SPILL!A dynamic-array formula has no room to spillClear the cells below it

📈 10. How to Find the GCF in R

Base R has no gcd() function, which surprises many students. The script below writes Euclid's algorithm in six lines, folds it over a list with Reduce, prints the prime factors, the Euclid table and the check, finds the GCF of the monomials 12x³y², 18x²y and −30xy⁴, and saves one 300 dpi figure.

Copy the whole block. It runs top to bottom in RStudio, Posit Cloud or Rscript gcf.R. Change only the x <- c(24, 36) line.
Base R only · optional: numbers::GCD(), pracma::gcd(), gmp::gcd.bigz() for huge numbers

10.1 The complete script

R, base only, saves gcf_plot.png

# ============================================================
# GCF calculator in R: numbers and monomials, with a 300 dpi plot
# StatsUnlock - https://statsunlock.com/gcf-calculator/
# Base R only. No packages to install.
# ============================================================

# ---- 1. Your numbers (change this line) --------------------
x <- c(24, 36)

# ---- 2. Euclid's algorithm for two numbers ------------------
gcd2 <- function(a, b) {
  a <- abs(a); b <- abs(b)
  while (b != 0) {
    r <- a %% b          # remainder
    a <- b
    b <- r
  }
  a
}
gcf_all <- function(v) Reduce(gcd2, v)            # fold over the list
lcm2    <- function(a, b) abs(a * b) / gcd2(a, b)
lcm_all <- function(v) Reduce(lcm2, v)

# ---- 3. Prime factorization (trial division) --------------
prime_factors <- function(n) {
  n <- abs(n); f <- c(); d <- 2
  while (n > 1) {
    while (n %% d == 0) { f <- c(f, d); n <- n / d }
    d <- d + 1
    if (d * d > n && n > 1) { f <- c(f, n); break }
  }
  f
}

g <- gcf_all(x)
l <- lcm_all(x)
cat("Numbers:", paste(x, collapse = ", "), "\n")
for (v in x) cat(v, "=", paste(prime_factors(v), collapse = " x "), "\n")
cat("GCF =", g, "\n")
cat("LCM =", l, "\n")

# ---- 4. Euclid table for the first two numbers ------------
a <- max(abs(x[1:2])); b <- min(abs(x[1:2]))
while (b != 0) {
  cat(sprintf("%g = %g x %g + %g\n", a, a %/% b, b, a %% b))
  r <- a %% b; a <- b; b <- r
}

# ---- 5. Check: GCF divides every number, quotients coprime -
q <- x / g
ok <- all(x %% g == 0) && gcf_all(q) == 1
cat("Quotients:", paste(q, collapse = ", "), "| check passed:", ok, "\n")
if (g == 1) cat("Verdict: the numbers are relatively prime.\n") else
  cat("Verdict: the greatest common factor is", g, "\n")

# ---- 6. GCF of monomials: 12x^3y^2, 18x^2y, 30xy^4 --------
coef <- c(12, 18, -30)
px   <- c(3, 2, 1)       # powers of x in each term
py   <- c(2, 1, 4)       # powers of y in each term
gc   <- gcf_all(abs(coef))
cat(sprintf("Monomial GCF = %gx^%gy^%g  (6xy)\n", gc, min(px), min(py)))
cat("Bracket coefficients:", paste(coef / gc, collapse = ", "),
    "| x powers:", paste(px - min(px), collapse = ", "),
    "| y powers:", paste(py - min(py), collapse = ", "), "\n")
cat("Factored: 6xy(2x^2y + 3x - 5y^3)\n")

# ---- 7. One 300 dpi figure: prime exponents ----------------
primes <- sort(unique(unlist(lapply(x, prime_factors))))
ex <- sapply(x, function(v) sapply(primes, function(p) sum(prime_factors(v) == p)))
ex <- matrix(ex, nrow = length(primes))
ex <- cbind(ex, apply(ex, 1, min))
png("gcf_plot.png", width = 1800, height = 1200, res = 300)
barplot(t(ex), beside = TRUE, names.arg = primes,
        col = c("#2563eb", "#ea580c", "#16a34a")[seq_len(ncol(ex))],
        legend.text = c(paste("Number", x), "GCF (lowest)"),
        xlab = "Prime", ylab = "Exponent",
        main = paste0("GCF(", paste(x, collapse = ", "), ") = ", g))
invisible(dev.off())
cat("Saved gcf_plot.png\n")

Output: 24 = 2 x 2 x 2 x 3, 36 = 2 x 2 x 3 x 3, GCF = 12, LCM = 72, Euclid lines 36 = 1 x 24 + 12 and 24 = 2 x 12 + 0, check passed: TRUE, and the monomial GCF 6xy with 6xy(2x^2y + 3x - 5y^3).

10.2 What each part does

PartWhat it does
a %% bThe remainder. In R, %% takes the sign of the divisor, so the script uses abs() first
Reduce(gcd2, v)Applies GCF(GCF(a, b), c) across any length of list
lcm2Uses LCM = |a × b| ÷ GCF
prime_factors()Trial division; fine for numbers up to about 1012
a %/% bInteger division, the quotient in each Euclid line
png(..., res = 300)Opens a 300 dpi file; dev.off() writes it

10.3 What the figure shows

A grouped bar chart with one bar per number for each prime, and a green bar for the lowest exponent. For 24 and 36 the green bars are 2 for the prime 2 and 1 for the prime 3, so GCF = 2² × 3 = 12.

10.4 Common R problems and fixes

ProblemFix
could not find function "gcd"Base R has none. Use the function above or numbers::GCD
Wrong answer above about 9 × 1015Doubles lose whole-number precision past 253. Use library(gmp); gcd.bigz(as.bigz("1219326312114007011"), as.bigz("1085200427667885993"))
Negative remainder surprises-7 %% 3 is 2 in R; take abs() first
Plot window blank in RscriptRscript writes to the PNG file only; open gcf_plot.png
Reduce on an empty vector returns NULLCheck length(x) > 0 first
Decimals give odd answers%% works on doubles; scale to whole numbers first

10.5 Useful one-liners

  • Reduce(function(a, b) if (b == 0) a else Recall(b, a %% b), c(48, 72, 120)) gives 24.
  • numbers::GCD(24, 36) and numbers::LCM(24, 36) give 12 and 72.
  • pracma::gcd(24, 36) also returns 12.
  • MASS::fractions(24/36) prints 2/3.
  • gmp::factorize(1219326312114007011) gives the prime factors of a 19-digit number exactly.

📈 11. How to Find the GCF in Python

Python makes the GCF easy: math.gcd works on integers of any size, and from Python 3.9 it takes any number of arguments. For algebra, SymPy's factor_terms factors out the GCF of a polynomial exactly. The script prints the same numbers as every other section and saves one 300 dpi figure.

Copy the whole block. Change only the nums = [24, 36] line and, for algebra, the poly = ... line.
math (built in) · sympy · matplotlib

pip install sympy matplotlib

11.1 The complete script

Python 3.9+, saves gcf_plot_py.png

# ============================================================
# GCF calculator in Python: numbers and polynomials, 300 dpi plot
# StatsUnlock - https://statsunlock.com/gcf-calculator/
# pip install sympy matplotlib
# ============================================================
import math
from functools import reduce
from sympy import factorint, symbols, factor_terms, gcd, expand
import matplotlib
matplotlib.use("Agg")            # remove this line in Jupyter to see the plot
import matplotlib.pyplot as plt

# ---- 1. Your numbers (change this line) --------------------
nums = [24, 36]

# ---- 2. GCF and LCM ----------------------------------------
g = math.gcd(*nums)              # Python 3.9+ takes any number of values
l = math.lcm(*nums)              # Python 3.9+
print("Numbers:", nums)
for n in nums:
    print(n, "=", " x ".join(f"{p}^{e}" if e > 1 else str(p) for p, e in factorint(n).items()))
print("GCF =", g)
print("LCM =", l)

# ---- 3. Euclid table, written out ---------------------------
a, b = max(nums[:2]), min(nums[:2])
while b:
    print(f"{a} = {a // b} x {b} + {a % b}")
    a, b = b, a % b

# ---- 4. Check: GCF divides every number, quotients coprime -
quot = [n // g for n in nums]
ok = all(n % g == 0 for n in nums) and math.gcd(*quot) == 1
print("Quotients:", quot, "| check passed:", ok)
print("Verdict:", "relatively prime" if g == 1 else f"the greatest common factor is {g}")

# ---- 5. Factor out the GCF of a polynomial -----------------
x, y = symbols("x y")
poly = 12*x**3*y**2 + 18*x**2*y - 30*x*y**4
G = gcd(gcd(12*x**3*y**2, 18*x**2*y), 30*x*y**4)   # GCF of the monomials
factored = factor_terms(poly)
print("Monomial GCF =", G)
print("Factored form:", factored)
print("Check expands back:", expand(factored) == expand(poly))

# ---- 6. One 300 dpi figure: prime exponents -----------------
primes = sorted(set().union(*[factorint(n).keys() for n in nums]))
fig, ax = plt.subplots(figsize=(6, 4))
w = 0.8 / (len(nums) + 1)
colors = ["#2563eb", "#ea580c", "#0d9488", "#9333ea"]
for i, n in enumerate(nums):
    ex = [factorint(n).get(p, 0) for p in primes]
    ax.bar([k + i * w for k in range(len(primes))], ex, w, label=str(n), color=colors[i % 4])
low = [min(factorint(n).get(p, 0) for n in nums) for p in primes]
ax.bar([k + len(nums) * w for k in range(len(primes))], low, w, label="GCF (lowest)", color="#16a34a")
ax.set_xticks([k + w * len(nums) / 2 for k in range(len(primes))], [str(p) for p in primes])
ax.set_xlabel("Prime"); ax.set_ylabel("Exponent")
ax.set_title(f"GCF({', '.join(map(str, nums))}) = {g}")
ax.legend()
fig.savefig("gcf_plot_py.png", dpi=300, bbox_inches="tight")
print("Saved gcf_plot_py.png")

Output: GCF = 12, LCM = 72, the two Euclid lines, check passed: True, Monomial GCF = 6*x*y and Factored form: 6*x*y*(2*x**2*y + 3*x - 5*y**3).

11.2 What each part does

PartWhat it does
math.gcd(*nums)GCF of the whole list; exact for integers of any length
math.lcm(*nums)LCM (Python 3.9 or later)
factorint(n)SymPy prime factorization as a dictionary {{prime: power}}
a // b, a % bQuotient and remainder for each Euclid line
gcd(m1, m2)SymPy GCF of two monomials, here 6*x*y
factor_terms(poly)Factors out the GCF of every term

Python traps: ^ is XOR, not a power, so x^2 is wrong; write x**2. math.gcd(-18, 27) returns 9 (positive). math.gcd(2.5, 5) raises a TypeError. SymPy keeps the GCF positive, so it writes −8a³b + 12a²b² − 4ab as 4ab(−2a² + 3ab − 1); the calculator's default is the equivalent −4ab(2a² − 3ab + 1).

11.3 What the figure shows

The same grouped bar chart as R: blue and orange bars for the exponents of 24 and 36, and green for the lowest shared power. The title reads GCF(24, 36) = 12.

11.4 Common Python problems and fixes

ProblemFix
TypeError: gcd() takes exactly 2 argumentsYou are on Python 3.8 or older. Use functools.reduce(math.gcd, nums)
AttributeError: module 'math' has no attribute 'lcm'Python 3.8 or older. Use a*b // math.gcd(a, b)
numpy.gcd gives a wrong big answerNumPy uses 64-bit integers; use math.gcd for huge values
SymPy returns a positive GCFMultiply by −1 yourself if your teacher wants a negative GCF
No plot appearsRemove matplotlib.use("Agg") in Jupyter, or open the PNG

11.5 Useful one-liners

  • math.gcd(48, 72, 120) gives 24.
  • math.gcd(1219326312114007011, 1085200427667885993) gives 987654321, exactly.
  • from fractions import Fraction; Fraction(24, 36) gives Fraction(2, 3).
  • sympy.factor_terms(6*x**2 + 9*x) gives 3*x*(2*x + 3).
  • sympy.gcd_list([12, 18, 30]) gives 6.

Run it from a terminal with python gcf.py, in Jupyter (add plt.show()), or paste it into Google Colab, where SymPy and Matplotlib are already installed.

📋 12. Reference Tables

12.1 GCF of common number pairs

How to use: find the pair, read the GCF, then divide both numbers by it to simplify a fraction.

PairGCFLCMPairGCFLCM
4 and 621218 and 24672
6 and 931824 and 361272
8 and 1242428 and 421484
12 and 1863636 and 4812144
15 and 2056045 and 6015180
16 and 2484848 and 7224144
12 and 1644854 and 3618108
10 and 1553032 and 481696

12.2 Divisibility rules (to find shared primes fast)

DivisorRuleExample
2Last digit is even36 → 6 is even
3Digit sum divisible by 324 → 2 + 4 = 6
4Last two digits divisible by 4136 → 36 ÷ 4 = 9
5Last digit 0 or 575
6Divisible by 2 and by 384
7Double the last digit, subtract from the rest; result divisible by 7126 → 12 − 12 = 0
8Last three digits divisible by 81,024 → 024 ÷ 8 = 3
9Digit sum divisible by 9126 → 9
10Last digit 0120
11Alternating digit sum divisible by 11121 → 1 − 2 + 1 = 0

12.3 Prime numbers below 200

How to use: when factoring, try these in order. Stop once the prime squared is bigger than what is left.

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199

12.4 Prime factorizations of 2 to 60

nPrimesnPrimesnPrimes
122² × 3302 × 3 × 5453² × 5
162⁴322⁵482⁴ × 3
182 × 3²362² × 3²502 × 5²
202² × 5402³ × 5542 × 3³
242³ × 3422 × 3 × 7562³ × 7
282² × 7442² × 11602² × 3 × 5

12.5 GCF vs LCM at a glance

QuestionGCFLCM
Built fromShared primes, lowest powerAll primes, highest power
Size≤ smallest number≥ largest number
Used forSimplifying fractions, equal groups, factoringAdding fractions, schedules that line up
Coprime numbers1Their product
Word clue"largest", "greatest", "split into", "biggest square""smallest", "next time together", "every"

12.6 Algebra GCF patterns

ExpressionGCFFactored form
6x² + 9x3x3x(2x + 3)
4a³ − 8a²4a²4a²(a − 2)
10xy + 15y5y5y(2x + 3)
x³ + x² + xxx(x² + x + 1)
−2m² − 6m−2m−2m(m + 3)
7p + 11q1Already prime (no common factor)

📈 13. Example Results

Eight worked problems, from a textbook pair to a 19-digit pair and an algebra trap. Each one can be checked with the calculator above.

1
TEXTBOOK CASE

GCF of 12 and 18

The pair in almost every Grade 6 worksheet.

Find the greatest common factor of 12 and 18.

12 = 2² × 318 = 2 × 3²GCF = 6LCM = 36
ItemValueNote
Shared primes2 and 3Both appear in 12 and 18
Lowest powers2¹ and 3¹min(2, 1) and min(1, 2)
GCF62 × 3
Check12 ÷ 6 = 2, 18 ÷ 6 = 3GCF(2, 3) = 1
Prime factor Venn diagram: GCF of 12 and 18 is 612182shared2 × 33GCF = 6 · LCM = 36
The overlap is 2 × 3 = 6.

What it means: Six is the largest number that divides both. 12/18 simplifies to 2/3.

How to write it: GCF(12, 18) = 6.

2
EXAM: THREE NUMBERS

GCF of 48, 72 and 120

Three numbers are where the ladder method shines.

Find the GCF of 48, 72 and 120 and show your method.

48 = 2⁴ × 372 = 2³ × 3²120 = 2³ × 3 × 5GCF = 24
ItemValueNote
Divide by 2 three times48, 72, 120 → 6, 9, 152 × 2 × 2 = 8
Divide by 36, 9, 15 → 2, 3, 5No shared prime left
GCF242³ × 3
LCM7202⁴ × 3² × 5
Ladder method for 48, 72 and 120248721202243660212183036915235
The left column 2 × 2 × 2 × 3 = 24 is the GCF. The bottom row 2, 3, 5 shares nothing.

What it means: 24 divides all three. The leftover numbers 2, 3 and 5 are coprime, which proves 24 is the greatest.

How to write it: GCF(48, 72, 120) = 24.

3
REAL WORLD

Cutting 45 cm and 75 cm ribbons

A craft teacher wants equal pieces with no waste.

Two ribbons are 45 cm and 75 cm long. Cut both into pieces of the same length, as long as possible, with nothing left over.

GCF = 15 cm45 ÷ 15 = 375 ÷ 15 = 58 pieces
ItemValueNote
453² × 5
753 × 5²
Longest piece15 cm3 × 5
Total pieces83 + 5
Ribbon lengths 45 and 75 with GCF 154545 cm7575 cm15GCF
The green bar is the 15 cm piece length.

What it means: Each piece is 15 cm. Any longer piece would leave waste on at least one ribbon.

How to write it: The longest equal piece is GCF(45, 75) = 15 cm, giving 3 + 5 = 8 pieces.

4
FRACTIONS

Simplify 84/126 in one step

Dividing by the GCF finishes the job at once.

Write 84/126 in lowest terms.

84 = 2² × 3 × 7126 = 2 × 3² × 7GCF = 42= 2/3
ItemValueNote
GCF422 × 3 × 7
84 ÷ 422New numerator
126 ÷ 423New denominator
Decimal0.67To 2 decimal places
Prime factor Venn diagram: GCF of 84 and 126 is 42841262shared2 × 3 × 73GCF = 42 · LCM = 252
The shared part 2 × 3 × 7 = 42 cancels.

What it means: Dividing by a smaller common factor such as 2 or 6 needs more steps. The GCF does it once.

How to write it: 84/126 = 2/3 (divided by GCF 42).

5
SPECIAL CASE

Coprime numbers: 35 and 64

Two composite numbers can still have GCF 1.

Find GCF(35, 64).

35 = 5 × 764 = 2⁶GCF = 1LCM = 2,240
ItemValueNote
Shared primesnone
GCF1Relatively prime
LCM2,24035 × 64
Euclid64 = 1 × 35 + 29 ... ends at 1
Prime factor Venn diagram: GCF of 35 and 64 is 135645 × 7shared(none)2^6GCF = 1 · LCM = 2,240
An empty overlap means GCF = 1.

What it means: Neither number is prime, but they share no prime. 35/64 is already in lowest terms.

How to write it: GCF(35, 64) = 1, so 35 and 64 are coprime.

6
NO ANSWER / ZERO

0 and 27, then 0 and 0

Zero behaves differently from every other number.

Find GCF(0, 27) and GCF(0, 0).

GCF(0, 27) = 27GCF(0, 0) undefinedEvery number divides 0
ItemValueNote
Factors of 271, 3, 9, 27All divide 0 too
GCF(0, 27)27The largest of them
GCF(0, 0)undefinedNo largest divisor exists
Softwarereturns 0A convention, not a real GCF
Factors of 27, all of which also divide 01133992727
Every factor of 27 also divides 0, so the GCF is 27.

What it means: GCF(0, n) = |n|. With all zeros there is no greatest common factor, and the calculator says so in fuchsia.

How to write it: GCF(0, 27) = 27; GCF(0, 0) is undefined.

7
LARGE NUMBERS

Two 19-digit numbers

Too big for Excel, easy for Euclid.

Find GCF(1,219,326,312,114,007,011, 1,085,200,427,667,885,993).

15 divisionsGCF = 987,654,321Above 253
ItemValueNote
Euclid steps15Each remainder is smaller
GCF987,654,321Last non-zero remainder
Quotients1,234,567,891 and 1,098,765,433Coprime
Excel#NUM!Over the 253 limit
Euclid algorithm reaching GCF 987654321 in 15 divisions1219326312114007011 = 1 × ... + 1341258844461210181085200427667885993 = 8 × ... + 12193352098917849... 11 more division lines ...2962962963 = 1 × ... + 9876543211975308642 = 2 × ... + 0
The remainder hits 987,654,321, then 0.

What it means: Euclid never needs prime factors, so size does not matter. Exact BigInt arithmetic keeps every digit.

How to write it: GCF = 987,654,321 by Euclid's algorithm (15 steps).

8
TRAP

−8a³b + 12a²b² − 4ab

Two marks lost here every year.

Factor out the GCF, starting with a negative.

GCF = −4abKeep the + 1Flip every sign
ItemValueNote
GCF of 8, 12, 44
Lettersa¹b¹Lowest powers
Wrong−4ab(2a² − 3ab)Dropped the 1
Right−4ab(2a² − 3ab + 1)Multiplies back exactly
Exponent of a in each term and in the GCF3term 12term 21term 31GCF
Powers of a: 3, 2, 1, so the GCF takes a¹.

What it means: −4ab ÷ −4ab = 1, not 0. Leaving out the 1 changes the expression.

How to write it: −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1).

✏️ 14. How to Find the GCF by Hand, Step by Step

This is the pen and paper method a teacher expects to see, worked on the same example as Sections 0, 7, 9, 10 and 11: 24 and 36. Then the algebra version on 12x³y² + 18x²y − 30xy⁴.

14.1 The written method

  1. Write each number as a product of primes. Divide by 2 while you can, then 3, then 5. 24 = 2 × 2 × 2 × 3 and 36 = 2 × 2 × 3 × 3.
  2. Use index form. 24 = 2³ × 3 and 36 = 2² × 3².
  3. Circle the primes found in both. 2 and 3.
  4. Take the lowest power of each. 2² (not 2³) and 3¹ (not 3²).
  5. Multiply. 2² × 3 = 12.
  6. Check by division. 24 ÷ 12 = 2 and 36 ÷ 12 = 3. 2 and 3 share nothing, so 12 is the greatest.
  7. Or use Euclid for big numbers. 36 = 1 × 24 + 12, 24 = 2 × 12 + 0. The last divisor is 12.
  8. For algebra: GCF(12, 18, 30) = 6; lowest x power 1; lowest y power 1; GCF = 6xy. Divide: 2x²y, 3x, −5y³. Answer 6xy(2x²y + 3x − 5y³). Multiply back to check.

14.2 On a scientific calculator

CalculatorKeysWhat you see
TI-84 Plus CEMATH ▶ (NUM menu) 9 (gcd(), then 24 , 36 ) ENTER. Item 8 is lcm(gcd(24,36) = 12
Casio fx-991CW / fx-82CW (ClassWiz CW)CATALOG, choose Numeric Calc, then GCD; type 24 , 36 ) EXEGCD(24,36) = 12
Casio fx-991ES PLUS 2nd edition / fx-115ES PLUSThe GCD and LCM functions are printed above keys on this model; press the shift key shown, then GCD, type 24 , 36 ) and =12
Casio fx-991EX / fx-570MS / fx-991MSNo GCD key on most of these. Use Euclid: 36 − 24 = gives 12, then 24 ÷ 12 = gives exactly 2, so the GCF is 1212, then 2

The TI-84 and fx-991CW keystrokes follow the makers' manuals. Menu layouts change between models and software versions, so check your own model's manual before an exam. On any calculator you can always do Euclid with division: keep dividing the last divisor by the last remainder until it divides exactly.

14.3 Practice problems with answers

1. GCF(8, 12)

4. (8 = 2³, 12 = 2² × 3)

2. GCF(16, 24)

8.

3. GCF(28, 42)

14. (2 × 7)

4. GCF(36, 48)

12.

5. GCF(18, 30, 42)

6.

6. GCF(17, 51)

17. (51 = 3 × 17, so 17 divides both)

7. GCF(49, 50)

1. Consecutive numbers are always coprime.

8. GCF(0, 0)

Undefined. There is no greatest common divisor of 0 and 0.

9. Factor 15x²y − 25xy²

5xy(3x − 5y).

10. Trap: factor −6m³ − 9m² − 3m

−3m(2m² + 3m + 1). Every sign flips, and the last term leaves 1.

14.4 Mistakes that lose marks

  • Taking the highest power of a shared prime. That gives the LCM, not the GCF.
  • Including a prime that is missing from one number. 5 is in 60 but not in 24, so it cannot be in GCF(24, 60).
  • Giving a common factor instead of the greatest one. 6 divides 24 and 36, but 12 is the GCF.
  • Dropping the 1 when a term equals the GCF: 4ab ÷ 4ab = 1.
  • Factoring out a negative but forgetting to change the sign of every term inside the brackets.
  • Including a letter that is missing from one term (x is not in 18y, so x is not in GCF(12xy, 18y)).
  • Not checking: always divide back, or multiply the factored form out.

🎯 15. When to Use This Method

Use the GCF when:

  • You want the largest equal group size, tile, piece or batch.
  • You need a fraction or a ratio in lowest terms.
  • You are starting any factoring problem in algebra (always factor out the GCF first).
  • You are reducing a screen ratio such as 1920:1080 to 16:9 (GCF 120).

Use something else when:

  • You need a common denominator or the next time two cycles line up: that is the LCM.
  • You want all the factors of a single number: use the factor calculator.
  • The GCF is 1 and you still need to factor: try grouping, difference of squares or the quadratic formula.

Real-world examples:

  1. A florist has 36 roses and 24 tulips and wants identical bouquets: GCF 12 bouquets, each with 3 roses and 2 tulips.
  2. A 54 by 36 cm floor: the biggest square tile is GCF(54, 36) = 18 cm, so 3 by 2 tiles.
  3. Gear teeth 48 and 30: GCF 6 tells an engineer how often the same teeth meet.
  4. Pixels 1920 by 1080: GCF 120 gives the aspect ratio 16:9.
Your situationFastest method
Two small numbers (under 100)Listing factors or mental prime factorization
Two or three numbers, need the LCM as wellPrime factorization
Big numbers, or a number with a large prime factorEuclid's algorithm
Classroom work with 2 to 4 numbersLadder (cake) method
Algebra termsCoefficient GCF times shared letters at lowest power
Many problems at onceBatch tab, or Excel GCD down a column

🔧 16. Common Mistakes and Troubleshooting

My GCF is bigger than one of the numbers

Cause: You multiplied the highest powers, which gives the LCM.

Fix: Use the lowest power of each shared prime. The GCF can never exceed the smallest number.

My answer divides both numbers but the book has a bigger one

Cause: You found a common factor, not the greatest.

Fix: Divide both numbers by your answer. If the results still share a factor, multiply it in.

Excel shows #NUM!

Cause: A negative number, or a value of 253 or more.

Fix: Use ABS(), or this calculator for very large numbers.

The calculator says "undefined"

Cause: Every input is 0.

Fix: Add a non-zero number. GCF(0, n) = |n|.

My factored form does not multiply back

Cause: A sign or a 1 was dropped inside the brackets.

Fix: Multiply the GCF into each bracket term and compare term by term.

I got 4ab but the answer key has −4ab

Cause: Both are correct; the key factored out a negative because the first term is negative.

Fix: Switch the sign option in Section 2 to match your teacher.

The tool will not read my expression

Cause: Brackets, decimals or fractions in the coefficients.

Fix: Expand first, and use whole numbers. Multiply through by a number to clear decimals.

Python gives a TypeError

Cause: math.gcd got a float, or you are on Python 3.8 with more than two numbers.

Fix: Pass integers, and use functools.reduce on old Python versions.

R says it cannot find gcd

Cause: Base R has no gcd function.

Fix: Paste the Euclid function from Section 10 or load the numbers package.

My Casio has no GCD key

Cause: Older models such as the fx-570MS lack it.

Fix: Use Euclid with the divide key, as shown in Section 14.2.

⚖ 17. Assumptions and Limitations

Assumptions

  1. Whole numbers only. The GCF is defined for integers. A decimal such as 0.75 is rejected with a message, because 0.75 is not a whole number. Scale by a power of 10 first.
  2. Absolute values. Signs are dropped for number GCFs, because GCF(−a, b) = GCF(a, b). The answer is always positive.
  3. Zero handling. A 0 is skipped (GCF(0, n) = |n|). If every input is 0 the GCF is reported as undefined.
  4. Algebra terms are monomials with whole-number coefficients. Letters are single characters with whole-number powers. Like terms are not combined, so type the expression already simplified.
  5. Sign convention for polynomials. By default a negative GCF is factored out when the first term is negative. Both signs give a correct factorization.

Limitations

  • Up to 50 numbers of up to 200 digits each. Euclid is exact at any size; prime factorization is skipped if a number has two very large prime factors, and the page says so.
  • Up to 30 algebra terms. Brackets, fractional or negative exponents and decimal coefficients are not supported.
  • It finds the GCF of monomials, not the GCD of two general polynomials such as x² − 1 and x² + 2x + 1 (that needs polynomial division).
  • It does not do the next factoring step (grouping, trinomials). Use the algebra calculator or the quadratic formula calculator for that.

🏁 18. Conclusion

___ Solve a problem above to add a conclusion for your own answer here.

What the answer is

A GCF calculator gives one number, or one monomial, that divides everything you entered: GCF(24, 36) = 12 and GCF(12x³y², 18x²y, 30xy⁴) = 6xy. This page also gives the LCM, the prime form, the factored polynomial and a check.

What it tells you

The GCF is the size of the largest equal group, the factor that simplifies a fraction in one move, and the first thing to pull out of any polynomial. A GCF of 1 tells you the numbers are coprime and the fraction is already in lowest terms.

Watch out for

The highest-power mix-up (that is the LCM), a common factor that is not the greatest, a dropped 1 inside the brackets, and sign changes when you factor out a negative. Always divide back or multiply out to check.

Next steps

Practise with Section 14.3, then move on to listing all factors with the factor calculator, mixed numbers with the mixed number calculator, and factoring quadratics with the quadratic formula calculator. Whenever a fraction, a ratio or a polynomial needs simplifying, come back to this GCF calculator.

❓ 19. Frequently Asked Questions

Q1. What is the GCF of two numbers?

The GCF (greatest common factor) of two numbers is the largest whole number that divides both with no remainder. For 24 and 36 it is 12, because 12 divides both and no larger number does.

Q2. How do you find the GCF?

Find the GCF by writing each number as a product of primes and multiplying the shared primes at their lowest power. For 24 = 2³ × 3 and 36 = 2² × 3², that is 2² × 3 = 12. For big numbers, Euclid's algorithm (divide and keep the remainder) is faster.

Q3. What is the greatest common factor of 24 and 36?

The greatest common factor of 24 and 36 is 12. 24 = 2³ × 3 and 36 = 2² × 3², so the shared part is 2² × 3 = 12. Their LCM is 72.

Q4. What is the greatest common factor of 12 and 18?

The greatest common factor of 12 and 18 is 6. 12 = 2² × 3 and 18 = 2 × 3², and the shared primes at their lowest power are 2 × 3 = 6.

Q5. What is the greatest common factor of 6 and 9?

The greatest common factor of 6 and 9 is 3. The factors of 6 are 1, 2, 3, 6 and the factors of 9 are 1, 3, 9, so the largest shared factor is 3.

Q6. What is the greatest common factor of 8 and 12?

The greatest common factor of 8 and 12 is 4. 8 = 2³ and 12 = 2² × 3, so the GCF is 2² = 4.

Q7. What is the greatest common factor of 36 and 48?

The greatest common factor of 36 and 48 is 12. 36 = 2² × 3² and 48 = 2⁴ × 3, so the GCF is 2² × 3 = 12.

Q8. How do you find the GCF of 3 numbers?

Find the GCF of 3 numbers by finding the GCF of the first two, then the GCF of that answer and the third number. GCF(48, 72, 120) = GCF(GCF(48, 72), 120) = GCF(24, 120) = 24. Prime factorization or the ladder method also work.

Q9. How do you find the GCF of monomials with variables and exponents?

Find the GCF of monomials by multiplying the GCF of the coefficients by each letter that appears in every term, raised to its lowest power. For 12x³y², 18x²y and 30xy⁴ the GCF is 6xy.

Q10. How do you factor out the GCF of a polynomial?

Factor out the GCF by finding the GCF of all the terms, dividing each term by it, and writing the GCF outside brackets. 12x³y² + 18x²y − 30xy⁴ = 6xy(2x²y + 3x − 5y³). Multiply back to check.

Q11. What does it mean to factor out the opposite of the GCF?

Factoring out the opposite of the GCF means taking out the negative of the GCF so the first term inside the brackets is positive. −8a³b + 12a²b² − 4ab = −4ab(2a² − 3ab + 1). Every sign inside the brackets changes.

Q12. What is the difference between GCF and LCM?

The GCF is the largest number that divides all the numbers, and the LCM is the smallest number that all of them divide into. For 24 and 36 the GCF is 12 and the LCM is 72. For two numbers, GCF × LCM = the product of the numbers.

Q13. Is GCF the same as GCD and HCF?

Yes, GCF, GCD and HCF are three names for the same number. GCF (greatest common factor) is common in the USA, HCF (highest common factor) in India and the UK, and GCD (greatest common divisor) in higher mathematics, Excel and programming.

Q14. What is the GCF of two numbers that have no common factors?

The GCF of two numbers with no common prime factor is 1, and the numbers are called relatively prime or coprime. For example GCF(35, 64) = 1, even though neither number is prime.

Q15. Can the GCF be negative or zero?

The GCF of numbers is always a positive whole number, so it cannot be negative or zero. GCF(0, n) equals |n|, and GCF(0, 0) is undefined. In algebra you may choose to factor out a negative GCF, such as −4ab.

Q16. How do you find the GCF on a calculator like a TI-84 or Casio?

On a TI-84 press MATH, move right to NUM, choose 9: gcd(, then type 24, 36) and ENTER to get 12. On a Casio fx-991CW use CATALOG, Numeric Calc, GCD. Models without a GCD key can do Euclid's algorithm with the divide key.

Q17. How do you find the GCF in Excel?

Use the Excel GCD function: =GCD(A2:A3) returns 12 when A2 is 24 and A3 is 36. It takes up to 255 numbers, but it returns #NUM! for negative values, so wrap them in ABS().

Q18. How do you find the GCF in R?

Base R has no gcd function, so write Euclid's algorithm in a few lines or use numbers::GCD(24, 36), which returns 12. Reduce(gcd2, c(48, 72, 120)) folds it over a list. The full script is in Section 10.

Q19. How do you find the GCF in Python?

Use math.gcd: math.gcd(24, 36) returns 12, and from Python 3.9 math.gcd(48, 72, 120) takes any number of values. For polynomials, sympy.factor_terms(12*x**3*y**2 + 18*x**2*y - 30*x*y**4) returns 6*x*y*(2*x**2*y + 3*x - 5*y**3).

Q20. How do you use the GCF to simplify fractions?

Divide the numerator and the denominator by their GCF to get the fraction in lowest terms in one step. For 24/36 the GCF is 12, so 24/36 = 2/3. For 84/126 the GCF is 42, so it is also 2/3.

📑 20. Cite This Tool

APA 7th edition
Pushbanathan, R. (2026). GCF calculator: Greatest common factor of numbers, monomials and polynomials with steps [Interactive calculator]. StatsUnlock. https://statsunlock.com/gcf-calculator/
BibTeX
@misc{statsunlock_gcf_2026, author={Pushbanathan, Reegan}, title={GCF Calculator: Greatest Common Factor of Numbers, Monomials and Polynomials with Steps}, year={2026}, publisher={StatsUnlock}, note={Interactive calculator, accessed 2 December 2026}, url={https://statsunlock.com/gcf-calculator/}}
Working sentence (fills with your answer after Solve)
The greatest common factor was computed with the StatsUnlock GCF Calculator (Pushbanathan, 2026), which uses exact integer arithmetic, prime factorization and Euclid's algorithm, and verifies each answer by division.

🔗 21. Related Tools

📖 22. Glossary of Terms

TermPlain-English meaning
Bézout identityThe fact that the GCF of a and b can be written as ax + by for some whole numbers x and y. For 24 and 36: 24(−1) + 36(1) = 12.
CoefficientThe number part of a term. In 18x²y the coefficient is 18.
Common factorA number that divides every number in a set. 6 is a common factor of 24 and 36, but not the greatest.
Composite numberA whole number above 1 with more than two factors, such as 24.
Coprime (relatively prime)Numbers whose GCF is 1, such as 35 and 64.
DivisorAnother word for factor: a number that divides another exactly.
Euclid's algorithmA method from about 300 BC: divide, keep the remainder, repeat. The last non-zero remainder is the GCF.
Exponent (power, index)The small raised number showing repeated multiplication. In 2³, the exponent is 3.
FactorA whole number that divides another with no remainder. The factors of 12 are 1, 2, 3, 4, 6, 12.
Factored formAn expression written as a product, such as 6xy(2x²y + 3x − 5y³).
GCDGreatest common divisor, the same as the GCF. Excel and programming languages use this name.
GCFGreatest common factor: the largest whole number (or monomial) dividing every number (or term).
HCFHighest common factor, the same as the GCF. Common in India and the UK.
Ladder (cake) methodDividing all numbers by a shared prime, row after row, until no prime is shared. The primes on the left multiply to the GCF.
LCMLeast common multiple: the smallest positive number that every number divides into.
MonomialA single algebra term: a coefficient times letters with whole-number powers, such as −4ab.
PolynomialA sum of monomials, such as 12x³y² + 18x²y − 30xy⁴.
Prime factorizationWriting a number as a product of primes, such as 36 = 2² × 3².
Prime numberA whole number above 1 whose only factors are 1 and itself, such as 2, 3, 5, 7.
QuotientThe result of a division. 36 ÷ 12 has quotient 3.
RemainderWhat is left after whole-number division. 36 ÷ 24 leaves remainder 12.

📚 23. References

Peer-reviewed sources behind the methods in this GCF calculator: Euclid's algorithm and its speed, GCD of many integers, polynomial GCDs, exact integer arithmetic, primality and factoring, and research on how students learn divisibility and algebra.

  1. Baladi, V., & Vallée, B. (2005). Euclidean algorithms are Gaussian. Journal of Number Theory, 110(2), 331–386. https://doi.org/10.1016/j.jnt.2004.08.008
  2. Bradley, G. H. (1970). Algorithm and bound for the greatest common divisor of n integers. Communications of the ACM, 13(7), 433–436. https://doi.org/10.1145/362686.362694
  3. Brown, W. S. (1971). On Euclid's algorithm and the computation of polynomial greatest common divisors. Journal of the ACM, 18(4), 478–504. https://doi.org/10.1145/321662.321664
  4. Collins, G. E. (1967). Subresultants and reduced polynomial remainder sequences. Journal of the ACM, 14(1), 128–142. https://doi.org/10.1145/321371.321381
  5. Dixon, J. D. (1970). The number of steps in the Euclidean algorithm. Journal of Number Theory, 2(4), 414–422. https://doi.org/10.1016/0022-314X(70)90044-2
  6. Goldberg, D. (1991). What every computer scientist should know about floating-point arithmetic. ACM Computing Surveys, 23(1), 5–48. https://doi.org/10.1145/103162.103163
  7. Havas, G., Majewski, B. S., & Matthews, K. R. (1998). Extended GCD and Hermite normal form algorithms via lattice basis reduction. Experimental Mathematics, 7(2), 125–136. https://doi.org/10.1080/10586458.1998.10504362
  8. Hensley, D. (1994). The number of steps in the Euclidean algorithm. Journal of Number Theory, 49(2), 142–182. https://doi.org/10.1006/jnth.1994.1088
  9. Lehmer, D. H. (1938). Euclid's algorithm for large numbers. The American Mathematical Monthly, 45(4), 227–233. https://doi.org/10.1080/00029890.1938.11990797
  10. Miller, G. L. (1976). Riemann's hypothesis and tests for primality. Journal of Computer and System Sciences, 13(3), 300–317. https://doi.org/10.1016/S0022-0000(76)80043-8
  11. Möller, N. (2008). On Schönhage's algorithm and subquadratic integer GCD computation. Mathematics of Computation, 77(261), 589–607. https://doi.org/10.1090/S0025-5718-07-02017-0
  12. Pollard, J. M. (1975). A Monte Carlo method for factorization. BIT Numerical Mathematics, 15(3), 331–334. https://doi.org/10.1007/BF01933667
  13. Rabin, M. O. (1980). Probabilistic algorithm for testing primality. Journal of Number Theory, 12(1), 128–138. https://doi.org/10.1016/0022-314X(80)90084-0
  14. Sfard, A., & Linchevski, L. (1994). The gains and the pitfalls of reification: The case of algebra. Educational Studies in Mathematics, 26(2–3), 191–228. https://doi.org/10.1007/BF01273663
  15. Shallit, J. (1994). Origins of the analysis of the Euclidean algorithm. Historia Mathematica, 21(4), 401–419. https://doi.org/10.1006/hmat.1994.1031
  16. Sorenson, J. (1994). Two fast GCD algorithms. Journal of Algorithms, 16(1), 110–144. https://doi.org/10.1006/jagm.1994.1006
  17. Stein, J. (1967). Computational problems associated with Racah algebra. Journal of Computational Physics, 1(3), 397–405. https://doi.org/10.1016/0021-9991(67)90047-2
  18. Vallée, B. (1998). Dynamics of the binary Euclidean algorithm: Functional analysis and operators. Algorithmica, 22(4), 660–685. https://doi.org/10.1007/PL00009246
  19. Weber, K. (1995). The accelerated integer GCD algorithm. ACM Transactions on Mathematical Software, 21(1), 111–122. https://doi.org/10.1145/200979.201042
  20. Zazkis, R., & Campbell, S. (1996). Divisibility and multiplicative structure of natural numbers: Preservice teachers' understanding. Journal for Research in Mathematics Education, 27(5), 540–563. https://doi.org/10.5951/jresematheduc.27.5.0540
STATS UNLOCK · statsunlock.com · GCF Calculator
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Statistical Models

Important Plots & Charts

Calculators and Converters