Skip to content
Math

FOIL Calculator

Enter the four coefficients of two linear binomials in the form (ax + b)(cx + d) and this calculator expands the product using the FOIL method. Each of the four multiplication steps is shown separately, then the like terms are collected into the final polynomial. Results update as you type.

Your details

The coefficient of x in the first factor (ax + b). Use negative values for subtraction.
The constant term in the first factor (ax + b). Negative values give subtraction.
The coefficient of x in the second factor (cx + d).
The constant term in the second factor (cx + d). Negative values give subtraction.
Expanded result
12x² - 5x - 2

The fully simplified polynomial after collecting like terms

Expression(3x - 2) × (4x + 1)
First (F)12x²
Outer (O)3x
Inner (I)-8x
Last (L)-2
Combined middle term-5x
x² coefficient12
x coefficient-5
Constant term-2
x² (First)12
x (Outer + Inner)-5
Constant (Last)-2

(3x - 2) × (4x + 1) = 12x² - 5x - 2

  • The x² coefficient is 12, which comes from multiplying the leading terms 3x and 4x.
  • The middle term (-5x) is the sum of the Outer (3x) and Inner (-8x) products.
  • The constant term -2 is the product of the two constant values -2 and 1.

Next stepTo reverse this process (factor the result back into two binomials), look for two numbers that multiply to -24 and add to -5.

Formula

(ax+b)(cx+d)=acFx2+(ad+bc)O+Ix+bdL(ax + b)(cx + d) = \underbrace{ac}_{\text{F}}x^2 + \underbrace{(ad + bc)}_{\text{O+I}}x + \underbrace{bd}_{\text{L}}

Worked example

Expand (3x - 2)(4x + 1). F: 3x × 4x = 12x². O: 3x × 1 = 3x. I: -2 × 4x = -8x. L: -2 × 1 = -2. Collect: 12x² + (3x - 8x) - 2 = 12x² - 5x - 2.

What is the FOIL method?

FOIL is a mnemonic for multiplying two binomials. It stands for First, Outer, Inner, Last: the four pairs of terms you multiply when expanding a product like (ax + b)(cx + d). Each letter names one multiplication step. F = first terms of each factor, O = outermost terms across the whole product, I = innermost terms, L = last terms of each factor. After completing all four multiplications you collect the like terms (the two x-terms from O and I) to write the result as a trinomial: acx² + (ad + bc)x + bd. The method is a structured way to apply the distributive property so no term is accidentally skipped.

How to use this calculator

Fill in the four input boxes with the coefficients a, b, c, and d of your two binomials (ax + b) and (cx + d). Use negative numbers for subtraction: to enter (2x - 5)(x + 3) set a = 2, b = -5, c = 1, d = 3. The result panel shows the expanded polynomial instantly, and the steps panel below walks through each of the four FOIL multiplications followed by collecting like terms. The bar chart visualizes the three term coefficients so you can see at a glance how large each contribution is. If the x-coefficient (Outer + Inner) is zero, the result is a difference of two squares and the middle bar disappears.

Special patterns to recognize

Two patterns appear so often they are worth memorizing. A perfect square trinomial arises when both binomials are identical: (ax + b)² = a²x² + 2abx + b². The middle term is always twice the product of the two coefficients. A difference of two squares arises when the binomials are conjugates: (ax + b)(ax - b) = a²x² - b². The Outer and Inner terms cancel perfectly, leaving no x term. Recognizing these shortcuts speeds up manual work significantly and is the foundation of factoring techniques used throughout algebra and calculus.

Reverse FOIL: factoring a trinomial

The reverse of FOIL is factoring. Given a trinomial px² + qx + r, you want two numbers whose product is p × r and whose sum is q. Those numbers let you split the middle term and factor by grouping. For example, 12x² - 5x - 2: multiply 12 × (-2) = -24, find two numbers that multiply to -24 and add to -5: that is -8 and +3. Rewrite as 12x² - 8x + 3x - 2, group as x(12x - 8) + 1(3x - 2), factor out common factors: 4x(3x - 2) + 1(3x - 2) = (4x + 1)(3x - 2). Checking with FOIL confirms the original trinomial.

FOIL term reference

LetterNameTerms multipliedResult
FFirstax × cxacx²
OOuterax × dadx
IInnerb × cxbcx
LLastb × dbd
-Collectadx + bcx(ad + bc)x
-ResultF + O + I + Lacx² + (ad+bc)x + bd

Each letter in FOIL names one multiplication step when expanding (ax + b)(cx + d).

Frequently asked questions

What does FOIL stand for in math?

FOIL stands for First, Outer, Inner, Last. Each word names one of the four pairs of terms you multiply when expanding a product of two binomials. First means the leading terms of each factor, Outer means the outermost terms of the whole expression, Inner means the innermost terms, and Last means the trailing terms of each factor. After multiplying all four pairs you collect the like terms to get the simplified polynomial.

What is a binomial?

A binomial is an algebraic expression with exactly two terms, for example (3x - 2) or (x + 5). The terms are connected by addition or subtraction. FOIL is specifically designed for multiplying two binomials. For expressions with more than two terms (trinomials, polynomials) you use the full distributive property or polynomial long multiplication instead.

Does FOIL work for three or more factors?

FOIL only applies directly to a product of two binomials. For three or more factors you multiply the first two binomials using FOIL, then multiply the result by the third factor term by term, and so on. Each step is just repeated application of the distributive property.

What is a difference of two squares and how do I spot it?

A difference of two squares occurs when you multiply conjugate binomials: (ax + b)(ax - b). The Outer and Inner products cancel out, leaving only a²x² - b². You can spot it because the two binomials are identical except that one has addition and the other has subtraction. Common examples: (x + 3)(x - 3) = x² - 9 and (2x + 5)(2x - 5) = 4x² - 25.

How do I check my FOIL answer?

Substitute a simple number for x in both the original product and your expanded result. If both give the same value, the expansion is correct. For example, expand (x + 2)(x + 3) to get x² + 5x + 6. Test with x = 1: left side (1 + 2)(1 + 3) = 3 × 4 = 12; right side 1 + 5 + 6 = 12. They match, so the expansion is right.

Sources

Written by Dr. Rajiv Menon, PhD Applied Mathematician · Bengaluru, India

Applied mathematician bridging algebraic theory and computational tools for students, engineers, and everyday problem-solvers.

Search 3,500+ calculators

Loading search…