Math calculator

FOIL Calculator

All four products written out — and an honest account of where the acronym stops.

Multiply two binomials

First, Outer, Inner, Last — each named and shown.

Exactly two terms

Exactly two terms

(2x + 3)(x − 5)

2x² − 7x − 15

Four products, two of which combine.

FFirst

2x²

2x × x

OOuter

−10x

2x × −5

IInner

3x

3 × x

LLast

−15

3 × −5

The same four products, as a grid

The box method: each row term multiplied by each column term
x−5
2x2x²−10x
33x−15

Four cells, four products — the same F, O, I and L in a layout that keeps working when the brackets get longer.

The method, step by step

  1. 1F — First terms2x × x = 2x²The first term of each bracket.
  2. 2O — Outer terms2x × −5 = −10xThe two on the outside of the whole expression.
  3. 3I — Inner terms3 × x = 3xThe two next to each other in the middle.
  4. 4L — Last terms3 × −5 = −15The last term of each bracket. Its sign is the product of two signs — a negative times a negative is positive here, and that is the sign most often lost.
  5. 5Write the four products out2x² − 10x + 3x − 15
  6. 6Collect the like terms−10x and 3x are like terms — they combine to −7xOnly the Outer and Inner products can ever combine — First and Last have different degrees.
  7. 7The answer2x² − 7x − 15

The four products, collected, match the direct product of the two brackets.

What this tool shows

Four products, named and shown separately, because the acronym is the working — not the answer it produces.

  • First, Outer, Inner and Last as four separate products, each with its result
  • The same four products laid out as a 2 × 2 grid
  • Difference of squares and perfect squares recognised and explained
  • Brackets with more than two terms refused by name, not silently mishandled
All four products named and shown The same four as a grid Two variables, not just x Free, no signup

Free, no signup — every answer re-checked against the direct product.

Updated 6 September 2026 · Works in any browser, no installation

FOIL stands for First, Outer, Inner, Last — the four products of two binomials. (2x + 3)(x − 5) gives 2x², −10x, 3x, −15, and the middle two combine: 2x² − 7x − 15.

At a glance

Formula shown
(a + b)(c + d) = ac + ad + bc + bd — First, Outer, Inner, Last. Only the Outer and Inner products can combine.
Scenario support
Exactly two terms in each bracket, in one variable or two.
Educational estimate
Planning support from the values you enter — not professional advice.

Four letters, four products

Each letter names a pair of terms to multiply, and the pairs are chosen by where they sit rather than by anything mathematical:

  • F — First. The first term of each bracket. In (2x + 3)(x − 5): 2x × x = 2x².
  • O — Outer. The two on the outside of the whole expression: 2x × −5 = −10x.
  • I — Inner. The two beside each other in the middle: 3 × x = 3x.
  • L — Last. The last term of each bracket: 3 × −5 = −15.

The order is a memory aid and nothing more — multiplication is commutative, so the four products can be taken in any sequence and added in any order. What the letters buy is completeness: four names for four products means you notice when you have written three.

The grid beside the calculator is the same four products in a 2×2 table, one row per term of the first bracket and one column per term of the second. It is not a rival method; it is this one with the bookkeeping made visual, which is why it keeps working when there are six products and FOIL has run out of letters.

Only the middle two can ever combine

After the four products are written, the collecting step is more constrained than it looks. First is the product of the two highest-degree terms and Last is the product of the two constants — they cannot be like terms with anything. Only Outer and Inner can combine, and in the ordinary case they do: in (2x + 3)(x − 5), −10x and 3x are like terms — they combine to −7x.

That is worth knowing because it tells you what the answer will look like before you finish. Two binomials multiply to at most three terms, always: one from First, one from Last, and one from Outer plus Inner. If you have four terms in your answer, either the two middle products were not like terms — which happens with two variables, as in (2x + 3y)(x − y) = 2x² + xy − 3y² — or something has gone wrong.

It also explains the two special shapes below. When Outer and Inner are opposites they cancel and the answer has two terms; when they are identical they double and the middle coefficient is twice one of them.

The Last product, where signs go missing

Three of the four products usually involve at most one negative. The Last product involves both constants, so it is the one where two negatives meet — and two negatives make a positive. In (x − 4)(x − 4) the Last product is −4 × −4 = 16, positive, even though both brackets contain a minus.

The sign belongs to the term, not to the operation between them. Reading (2x + 3)(x − 5) as “2x + 3, then x, then 5” and treating the minus as something to apply at the end is how the Outer and Last products both come out wrong. Reading it as “2x and +3” times “x and −5” makes all four products mechanical.

(3x − 2)(4x + 7) is the case where all of this matters at once: F gives 12x², O gives 21x, I gives −8x, L gives −14, and the middle two combine to give 12x² + 13x − 14. Every sign there is a product of two signs, and none of them is a decision.

Two shapes worth recognising on sight

Two products come up often enough that spotting them saves the whole procedure:

  • A sum times a difference. (x + 5)(x − 5) = x² − 25. The Outer and Inner products are −5x and 5x — opposites, so they cancel and there is no middle term at all. That is the difference of squares, and it works in reverse as a factorisation.
  • A bracket squared. (x + 3)(x + 3) = x² + 6x + 9. The Outer and Inner products are equal, so the middle term is twice the product of the two terms. This is why (x + 3)² is not x² + 9: squaring a sum is not squaring each part, and the 6x is exactly the doubled cross term the mistake omits.

Both patterns hold with a minus too. (x − 4)(x − 4) = x² − 8x + 16 — still a perfect square, with a negative middle term and a positive constant. Recognising them from the answer is the same skill in reverse, and it is what the Factoring Trinomials Calculator looks for first.

Where FOIL stops, and what to do then

FOIL works because two terms times two terms is four products, and it names four. Multiply a binomial by a trinomial and there are six — there is no letter for the fifth and sixth, and the acronym has nothing to say. This is not a subtlety: it is the point at which people who learned FOIL as the method for multiplying brackets get stuck, and the tool above refuses those inputs rather than answering them, because answering them quietly would confirm the wrong lesson.

What generalises is the underlying rule: every term in the first bracket multiplies every term in the second. m terms times n terms is m×n products. The grid is that rule laid out so nothing can be skipped, and the Multiplying Polynomials Calculator is where it lives here — along with three factors at once, and any number of variables.

FOIL is still worth knowing. It is fast, it is the most common case in an algebra course, and its four names make an omission obvious. Just hold it as a name for one case rather than as the technique itself, and the transition to six products costs nothing.

Reverse FOIL is just factoring

“Reverse FOIL” means starting from the answer — a trinomial — and recovering the two brackets. It is a real and useful skill, and it is factoring under a different name: the search for two numbers that multiply to a×c and add to b is exactly the search for the Outer and Inner products that combine to the middle term.

That search is shown pair by pair on the Factoring Trinomials Calculator, which is where it belongs — one page owning that arithmetic is what lets both pages be trusted about it. There is no separate reverse-FOIL algorithm to learn.

Sources and methodology

The distributive law is not a figure to cite; it is the definition the four products follow from, and it is written out above. What is cited is the standard reference statement of the special products, for anyone who wants the canonical identities beside these.

Method. Every figure on this page comes from src/lib/foil.ts over the exact-rational term algebra in src/lib/algebra/parse.ts, which represents a term as a coefficient and a map of variable to exponent — so two variables are a normal case rather than an extension. The four named products are computed individually and then collected, and the result is compared against the direct product of the two term lists before anything is displayed. That engine is verified on every change against 77 hand-written assertions, including that the four products always re-collect to the direct product, and that a bracket with three terms is refused rather than answered. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Multiplying PolynomialsMultiply polynomials of any size in any number of variables, by grid, vertical or term-by-term layout, with the product count that catches a dropped term.
Factoring TrinomialsFactor a trinomial by the AC method with every factor pair of ac listed, the common factor taken out first, and the answer multiplied back out to check it.
Adding and Subtracting PolynomialsAdd or subtract polynomials with the sign flip shown as its own step, like terms aligned in columns, and a visible gap wherever a power is missing.
Polynomial DivisionDivide polynomials by long division or synthetic division, with the quotient, the remainder, the remainder theorem check and every stage of the working.
Quadratic FormulaSolve any quadratic with exact roots — surds stay surds and a negative discriminant gives the complex pair — plus the vertex, the factored form and every step of the working.
Completing the SquareRewrite ax² + bx + c as a(x − h)² + k with every step shown, solve by the method, or find the constant that completes a square — all in exact fractions.

More in Math, or browse all calculators.

Read the guide

FOIL is one operation out of four, and the others have their own characteristic failures. Adding, Multiplying and Dividing Polynomials — the Four Operations covers all of them: the minus that reaches only the first term when subtracting, the product counting that catches a dropped term when multiplying, the missing power that shifts a column when dividing, and the degree check that catches most leading-term errors in five seconds.

Educational use disclaimer

This calculator multiplies two binomials and names the four products FOIL stands for. It deliberately refuses brackets with more than two terms rather than answering them, because FOIL names exactly four products and does not extend — the Multiplying Polynomials Calculator handles the general case. The arithmetic is exact and every answer is checked against the direct product of the two brackets before it is shown.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the FOIL calculator with all four products named and shown individually, plus the same four as a 2×2 grid.
  2. Brackets with more than two terms are refused by name and pointed at the Multiplying Polynomials Calculator, because the acronym does not extend and answering them quietly would teach that it does.
  3. Recognises the difference of squares and the perfect square, and explains where the vanishing or doubled middle term comes from.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.