FOIL method calculator
The FOIL method calculator multiplies two binomials in the form (ax + b)(cx + d) and makes every part of the distribution visible.
Run — free
Enter the four coefficients, including negative values where needed, and receive the first, outer, inner, and last products in order. The calculator then adds the two linear products, preserves the quadratic and constant terms, and returns the simplified polynomial. It is useful for checking homework, reviewing signs, or generating dependable worked steps for algebra exercises.
Translate each binomial into four coefficients
Begin by matching your expression to (ax + b)(cx + d). The value a is the coefficient multiplying x in the first binomial, while b is its constant. The values c and d play the same roles in the second binomial. For example, (2x + 3)(4x - 5) uses a = 2, b = 3, c = 4, and d = -5. The minus sign belongs to the coefficient, so enter negative five rather than trying to add an operator separately. An omitted coefficient of x means one: (x + 7) has a = 1, and (-x + 2) has a = -1. If a constant is absent, enter zero. Writing the four values down before calculating prevents the most common setup errors. The calculator accepts integers and decimals, but every field must contain a finite number within the published limit. Once the coefficients are identified, the original expression is reconstructed in the result so you can confirm that the signs and values were interpreted as intended before relying on the expansion.
Follow First, Outer, Inner, and Last
FOIL is a memory aid for applying the distributive property to two binomials. First multiplies the first terms, ax and cx, producing acx². Outer multiplies ax by d, producing adx. Inner multiplies b by cx, producing bcx. Last multiplies the constants b and d, producing bd. The calculator reports each operation separately with its numeric value and algebraic term, so a sign mistake can be located instead of merely revealing that the final answer is wrong. In (2x + 3)(4x - 5), the first product is 8x², the outer product is -10x, the inner product is 12x, and the last product is -15. FOIL does not introduce a new multiplication rule; it simply names the four products required by distribution. That distinction matters because the same reasoning extends beyond binomials, even though the FOIL acronym does not. Reading the steps in order also helps verify that every term in the first factor was multiplied by every term in the second factor exactly once.
Combine the two like terms and check the result
After the four products are found, only the outer and inner products are automatically like terms. Both contain x to the first power, so their coefficients are added: ad + bc. The first product has x² and the last product has no variable, so neither can be merged with the middle terms. The general result is acx² + (ad + bc)x + bd. For the example, -10x + 12x becomes 2x, giving 8x² + 2x - 15. The output includes this middle-term calculation, the three resulting coefficients in descending degree order, and a formatted equation. Zero coefficients are handled naturally: a missing middle term may make the displayed result a binomial rather than a three-term expression, while all three coefficient positions remain available for programmatic use. To check an answer independently, substitute a simple value such as x = 1 into both the original factors and the expanded polynomial. Equal values support the expansion, although reviewing the four named products remains the clearest way to diagnose a discrepancy. API use costs $0.002 per item, while the browser calculator can be used directly on the page.
What you can do with it
Check algebra homework
Compare every FOIL product with your written work and identify exactly where a coefficient or sign changed.
Prepare worked examples
Create consistent step-by-step binomial multiplication examples for lessons, tutoring sessions, or practice sheets.
Verify symbolic preprocessing
Use the returned coefficient array and formatted equation when a workflow needs a transparent expansion of two linear factors.
FAQ
What does FOIL stand for?
FOIL stands for First, Outer, Inner, and Last, the four term pairs multiplied when distributing two binomials.
Can I use negative coefficients?
Yes. Enter the sign as part of the coefficient, such as d = -5 for a second binomial ending in minus five.
Can the calculator multiply binomials with decimal coefficients?
Yes. Finite integer and decimal coefficients are accepted within the published input limit, and output is rounded deterministically to avoid floating-point noise.
Why does my result have only two visible terms?
A coefficient may be zero. The formatter omits zero terms, although the coefficients array still contains the quadratic, linear, and constant positions.
Does FOIL work for three-term polynomials?
The distributive property does, but this FOIL calculator is specifically designed for two binomials, each containing a linear term and a constant.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/foil-method \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":2,"b":3,"c":4,"d":-5}'const res = await fetch("https://api.kit.forhosting.com/algebra/foil-method", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 2,
"b": 3,
"c": 4,
"d": -5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/foil-method",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 2,
"b": 3,
"c": 4,
"d": -5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/foil-method", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":2,"b":3,"c":4,"d":-5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":2,"b":3,"c":4,"d":-5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/foil-method", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 2,
"b": 3,
"c": 4,
"d": -5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.foil_method",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs_coefficient | 1000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |