Home
Enter an integer and we'll break it into primes.
Integer between 2 and 10¹².
a of ax² + bx + c.
b of ax² + bx + c.
c of ax² + bx + c.
Example: 12, 18, 24 — max 20 numbers, each ≤ 10⁹.
Term is (ax)³ = a³x³.
Term is b³.
Plus or minus between terms.

What Is Factoring?

Factoring is the process of writing a mathematical object as a product of simpler objects. In arithmetic, factoring an integer means writing it as a product of primes — for example 360 = 2³ × 3² × 5. In algebra, factoring a polynomial means writing it as a product of lower-degree polynomials — for example x² − 5x + 6 = (x − 2)(x − 3).

Factoring is a foundational technique in algebra because it turns complicated expressions into products, making it possible to solve equations, simplify fractions, and identify structure. This calculator handles the most common factoring tasks encountered in school and engineering maths.

Key identities used in this calculator:

Difference of squares: a² − b² = (a − b)(a + b)

Perfect square: a² ± 2ab + b² = (a ± b)²

Sum of cubes: a³ + b³ = (a + b)(a² − ab + b²)

Difference of cubes: a³ − b³ = (a − b)(a² + ab + b²)

Quadratic formula: x = (−b ± √(b² − 4ac)) / (2a)

How the Factoring Calculator Works

Choose the type of factoring you need from the mode selector:

  • Prime factorization — enter any integer up to 10¹². The calculator uses trial division to split it into prime factors, then reports the factorisation, the divisor count τ(n), the divisor sum σ(n), and the full list of divisors.
  • Quadratic trinomial — enter the integer coefficients a, b, c of ax² + bx + c. The calculator extracts the GCF, computes the discriminant Δ = b² − 4ac, finds the roots, and produces the fully factored form. It distinguishes perfect-square trinomials, rational-root cases (factorable over ℤ), and irreducible cases.
  • GCF and LCM — enter a comma-separated list of integers. The calculator uses the Euclidean algorithm to find the greatest common factor, then computes the least common multiple, with prime factorisations shown for each number.
  • Sum or difference of cubes — enter a and b (the numbers inside the cubes) and choose sum or difference. The calculator applies the standard cube identities and shows the factored form.

Prime Factorization

Every integer greater than 1 can be written uniquely as a product of primes — this is the Fundamental Theorem of Arithmetic. The calculator uses trial division: divide by 2 as many times as possible, then by 3, 5, 7, …, up to √n. The primes that remain are the prime factors.

From the prime factorisation you can immediately read off useful number-theoretic quantities:

  • Number of divisors τ(n) = ∏(eᵢ + 1), where eᵢ is the exponent of the i-th prime.
  • Sum of divisors σ(n) = ∏(pᵢ^(eᵢ+1) − 1) / (pᵢ − 1).
  • Perfect square if and only if every exponent is even.
  • Perfect cube if and only if every exponent is divisible by 3.

Quadratic Trinomials

A quadratic ax² + bx + c with integer coefficients factors over the integers exactly when its discriminant Δ = b² − 4ac is a perfect square. In that case the roots r₁ = (−b + √Δ) / (2a) and r₂ = (−b − √Δ) / (2a) are rational, and the trinomial can be written as a(x − r₁)(x − r₂).

The calculator reports three cases:

  • Δ > 0 and a perfect square — two distinct rational roots, fully factorable.
  • Δ = 0 — one repeated rational root, perfect square trinomial.
  • Δ > 0 but not a perfect square — two irrational roots; irreducible over ℤ.
  • Δ < 0 — no real roots; irreducible over ℝ.

The factored form is built by reducing each rational root to lowest terms p/q, so the factor is (qx − p), and the leading coefficient is the integer a / (q₁q₂). This guarantees integer coefficients in the output.

GCF and LCM

The greatest common factor (GCF, also called GCD) of a set of integers is the largest integer that divides all of them. The least common multiple (LCM) is the smallest positive integer that all of them divide. They are related by

GCF(a, b) × LCM(a, b) = |a × b|

For more than two numbers, both are computed iteratively: GCF(a, b, c) = GCF(GCF(a, b), c), and the same for LCM. The calculator uses the Euclidean algorithm for GCF, which is fast and robust.

Sum and Difference of Cubes

The cube identities are less famous than the difference of squares but just as useful:

  • Sum: a³ + b³ = (a + b)(a² − ab + b²)
  • Difference: a³ − b³ = (a − b)(a² + ab + b²)

Note the sign pattern: the linear factor uses the same sign as the original expression, while the middle term of the quadratic factor uses the opposite sign. For example:

  • x³ + 8 = (x + 2)(x² − 2x + 4)
  • 8x³ − 27 = (2x − 3)(4x² + 6x + 9)

Assumptions and Limitations

  • All coefficients and inputs must be integers. The calculator does not accept decimal or symbolic coefficients.
  • Prime factorization is limited to integers up to 10¹². Trial division at this limit is fast but not instant for prime inputs near the maximum.
  • Quadratic factoring reports exact factored forms only when the roots are rational. Irrational and complex roots are reported but the expression is not further factored over ℤ.
  • The GCF/LCM list accepts up to 20 numbers, each up to 10⁹, to avoid integer overflow in JavaScript's floating-point arithmetic.
  • The sum/difference of cubes mode uses the specific form a³x³ ± b³, not general cubic expressions.
  • This is an educational and cross-checking tool. For symbolic algebra of higher-degree polynomials, use a computer algebra system.

❓ Factoring Calculator FAQ

What is prime factorization?

Prime factorization is writing an integer as a product of prime numbers. For example, 360 = 2³ × 3² × 5. By the Fundamental Theorem of Arithmetic, every integer greater than 1 has a unique prime factorization (up to the order of the factors).

How do I know if a quadratic factors over the integers?

Compute the discriminant Δ = b² − 4ac. The trinomial factors over the integers exactly when Δ is a perfect square (including 0). If Δ is negative, there are no real roots; if Δ is positive but not a perfect square, the roots are irrational and the trinomial does not factor over ℤ.

What does "irreducible over the reals" mean?

It means the quadratic cannot be written as a product of two linear factors with real coefficients. This happens when the discriminant is negative, so the parabola does not cross the x-axis. The quadratic is called "prime" in that case.

Why does the calculator extract the GCF first?

Extracting the greatest common factor simplifies the remaining trinomial and often makes it easier to factor. For example, 6x² + 12x + 6 = 6(x² + 2x + 1) = 6(x + 1)². The calculator always extracts the GCF before attempting further factoring.

How is the LCM calculated?

For two integers a and b, LCM(a, b) = |a × b| / GCF(a, b). For more than two numbers, apply this iteratively: LCM(a, b, c) = LCM(LCM(a, b), c). The calculator shows the intermediate steps.

What is the difference between GCF and LCM?

The GCF is the largest number that divides all the given numbers. The LCM is the smallest number that all the given numbers divide. For 12 and 18: GCF = 6, LCM = 36. They are related by GCF × LCM = 12 × 18 = 216.

Can I factor a sum of squares a² + b²?

Not over the real numbers. Unlike the difference of squares, a² + b² has no real linear factors. It is irreducible over ℝ. Over the complex numbers, a² + b² = (a + bi)(a − bi), where i² = −1.

What is the sum-of-cubes formula used for?

It factors expressions of the form a³ + b³ into a linear factor (a + b) and an irreducible quadratic factor (a² − ab + b²). It is used to simplify rational expressions, solve cubic equations, and evaluate limits in calculus.

Why are my coefficients rejected?

The calculator requires integer coefficients for exact factoring. If you need to factor something like 0.5x² − 1.5x + 1, multiply through by 2 to get x² − 3x + 2, then factor that. The factored form of the original expression will have an extra factor of 1/2 out front.

Can the calculator handle very large numbers?

Prime factorization works up to 10¹². For larger integers, trial division becomes slow and a specialized factoring algorithm (Pollard's rho, quadratic sieve, etc.) is needed. The GCF/LCM mode is limited to 10⁹ per number to avoid integer overflow.