Convolution calculator
Slide one sequence across another and add up the products at each step: [1, 2, 3] convolved with [0.5, 0.5] gives [0.5, 1.5, 2.5, 1.5]. Every partial overlap is kept, so the result has n + m − 1 values. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- First text
- 1, 2, 3
- Second text
- 0.5, 0.5
- Length a
- 3
- Length b
- 2
- Length
- 4
- Sequence
- 0.5, 1.5, 2.5, 1.5
Discrete convolution is the fundamental operation of signal processing and applied mathematics: it slides one finite sequence across another and, at every overlap, multiplies the aligned values and adds the products. Given two sequences a of length n and b of length m, this calculator returns their full linear convolution, a new sequence of length n plus m minus one whose k-th value is the sum of a[i] times b[j] over every pair of indices with i plus j equal to k. It is the same computation behind FIR filtering, moving averages, polynomial multiplication and probability distributions of sums of independent dice. Both sequences must contain at least one value and every value must be a finite number; empty sequences and non-finite entries such as NaN or Infinity are rejected with a clear validation error.
What discrete convolution means and how it is computed
Convolution answers a simple question: if you flip one sequence, slide it past the other and at each alignment multiply the overlapping pairs and sum the products, what number do you read at each position? Formally, for sequences a of length n and b of length m, the convolution c equals a star b is the sequence of length n plus m minus one defined by c[k] equals the sum of a[i] times b[k minus i] over every valid i.
A concrete example makes it tangible: convolving [1, 2, 3] with [0.5, 0.5] gives [0.5, 1.5, 2.5, 1.5], because each output sample is the average of one input sample with its neighbor, with half-weight edges at the boundaries. This 'full' mode, which this tool returns, keeps every partial overlap, including the single-touch positions at both ends. The direct algorithm used here performs n times m multiply-accumulate steps, which is instant for the sequences used in teaching, filter design and data analysis.
It is worth knowing that convolution is commutative, so a star b equals b star a, and associative, so chained smoothings can be reordered without changing the result. The operation also distributes over addition, which is why linear systems theory builds so much on it.
Inputs, limits and validation rules
The calculator accepts two fields, a and b, each a non-empty array of numbers. Values may be integers, decimals or negatives, and numeric strings in scientific notation such as 1.5e-3 are coerced safely. Two hard rules protect the contract.
First, neither sequence may be empty: a zero-length input has no convolution and is rejected rather than silently treated as a zero impulse. Second, every element must be a finite number; NaN, Infinity and values that would overflow to non-finite results during accumulation are refused with a message naming the offending field and index. Each sequence is limited to 4096 elements, which keeps the direct O(n·m) loop comfortably inside the compute budget while covering every realistic educational and engineering use.
Where convolution is used in practice
Convolution appears in far more places than its name suggests. In digital signal processing it is how a finite impulse response filter is applied: the kernel b holds the tap weights and the output is the filtered signal, so a moving average of width three is simply convolution with [1/3, 1/3, 1/3]. In probability, the distribution of the sum of two independent discrete random variables is the convolution of their probability mass functions; convolving the uniform distribution of one die with itself yields the familiar triangular distribution of two dice.
In algebra, multiplying two polynomials is exactly convolving their coefficient lists, which makes this tool a quick checker for symbolic homework. In image processing, separable two-dimensional kernels are applied as two one-dimensional convolutions in sequence. Even echo and reverb in audio are convolutions with an impulse response recorded in a real room.
Wherever a system's output is a shifted, scaled superposition of its input, convolution is the operation describing it.
What you can do with it
Apply an FIR filter to a sampled signal
Enter your samples as sequence a and the filter tap weights as sequence b to obtain the filtered output. A smoothing kernel such as [0.25, 0.5, 0.25] removes high-frequency noise without any signal-processing library.
Distribution of the sum of dice
Convolve the probability mass function of one fair die with itself to get the exact probabilities for the sum of two dice, and convolve again for three dice. Each step is one call with finite, checkable numbers.
Multiply polynomials by hand verification
Since polynomial multiplication is convolution of coefficient lists, enter the coefficients of both factors and compare the output sequence with your symbolic expansion to catch sign and alignment errors instantly.
FAQ
What is the length of the convolved sequence?
If sequence a has n values and sequence b has m values, the full convolution has n + m - 1 values.
Does the order of the two sequences matter?
Conventionally the longer signal goes in a and the shorter kernel in b.
Why was my input rejected?
The two hard rules are: neither sequence may be empty, and every element must be a finite number. NaN, Infinity, or results that overflow during accumulation are rejected with an error naming the field and the index of the offending value.
Is this circular or linear convolution?
This tool computes the full linear convolution with zero-padding at both ends, the same result you would get from direct summation. It does not wrap the sequences around as circular (cyclic) convolution does.
Is there a size limit?
Each sequence may contain up to 4096 finite numbers.
Related tools
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/math/convolution \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":[1,2,3],"b":[0.5,0.5]}'const res = await fetch("https://api.kit.forhosting.com/math/convolution", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": [
1,
2,
3
],
"b": [
0.5,
0.5
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/convolution",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": [
1,
2,
3
],
"b": [
0.5,
0.5
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/convolution", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":[1,2,3],"b":[0.5,0.5]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":[1,2,3],"b":[0.5,0.5]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/convolution", 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": [
1,
2,
3
],
"b": [
0.5,
0.5
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.convolution",
"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_items | 4096 |
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. |
Technical notes
The free browser tool and the paid API run the identical pure function, so results never diverge between channels.
Inputs, limits and validation rules
The output object reports length_a, length_b, the output length, and the convolved sequence itself under the key sequence, so scripts can assert sizes without recomputing them.
Where convolution is used in practice
The API path costs $0.002 per request, while the browser tool runs the identical math for free.
Technical questions
How much does the API cost?
The browser calculator is free and unlimited. Calling the same capability through the API costs $0.002 per request; both channels run the identical deterministic function.