Circular vs Linear Convolution Calculator

Find out whether your circular (FFT-based) convolution length is long enough to exactly match the true linear convolution, or if it will alias.

🔄 Circular vs Linear Convolution Calculator
Signal length (Lx)8
samples
24,096
Kernel length (Lh)5
samples
12,048
Chosen circular length (N)8
samples
18,192
Aliasing status
Required linear length
Aliased samples
Smallest safe N (power of 2)
Step-by-step working

🔄 What is Circular vs Linear Convolution?

Circular convolution is what you actually get when you multiply two signals' DFTs together and inverse-transform the result, a periodic, wraparound version of ordinary (linear) convolution. Linear convolution is the "true" filtering operation most engineers mean by "convolution," where a signal passes through a filter exactly once with no wraparound. The two only agree when the transform length is chosen large enough, and mismatching them is one of the most common bugs in FFT-based filtering code.

Audio and communications engineers who implement FFT-based (fast) convolution for reverb, echo cancellation, or channel filtering must zero-pad every block to avoid this exact aliasing artifact, or they introduce audible clicks and distortion at block boundaries. Image processing engineers hit the 2D version of the same issue when applying FFT-based filters to images, since an undersized transform wraps pixel data from one edge of the image onto the other. Anyone implementing overlap-add or overlap-save block convolution needs to reason about this trade-off explicitly, since those methods exist specifically to manage it.

A common misconception is that any FFT length "big enough to hold the signal" is safe. It is not: the FFT length must be at least as large as the combined linear convolution output, Lx + Lh - 1, not just the signal length alone. Choosing N equal to the signal length (a natural first instinct) silently corrupts the last Lh - 1 samples of every block.

This calculator checks any chosen circular length N against your signal and kernel lengths, reports exactly how many samples would be corrupted if N is too short, and shows the smallest power-of-2 length that avoids the problem entirely.

📐 Formula

aliased samples = max(0, Lx + Lh − 1 − N)
Lx = signal length (samples)
Lh = kernel (filter) length (samples)
N = chosen circular convolution / FFT length (samples)
Circular convolution equals linear convolution exactly when N ≥ Lx + Lh − 1
Example: Lx = 8, Lh = 5, N = 8 → required length 12, so 4 samples alias.

📖 How to Use This Calculator

Steps

1
Enter the signal and kernel lengths. Type in the number of samples in your signal and your filter (kernel).
2
Enter your chosen circular length. Type in the FFT or circular convolution length N you plan to use.
3
Check for aliasing. Click Calculate to see whether that length causes aliasing, how many samples are affected, and the smallest safe length.

💡 Example Calculations

Example 1 — Undersized FFT Length (Common Mistake)

Lx = 8, Lh = 5, N = 8 (equal to signal length only)

1
Required length = 8 + 5 − 1 = 12 samples
2
Aliased samples = max(0, 12 − 8) = 4 samples
Status = Aliasing on 4 sample(s), smallest safe N = 16
Try this example →

Example 2 — Correctly Zero-Padded Length

Lx = 8, Lh = 5, N = 12 (the exact minimum safe length)

1
Required length = 8 + 5 − 1 = 12 samples
2
Aliased samples = max(0, 12 − 12) = 0 samples
Status = No aliasing (exact match), smallest safe N = 16
Try this example →

Example 3 — Block Convolution Buffer Check

Lx = 1,024, Lh = 64, N = 1,024

1
Required length = 1,024 + 64 − 1 = 1,087 samples
2
Aliased samples = max(0, 1,087 − 1,024) = 63 samples
Status = Aliasing on 63 sample(s), smallest safe N = 2,048
Try this example →

❓ Frequently Asked Questions

What is the difference between circular and linear convolution?+
Linear convolution slides a filter across a signal exactly once, producing Lx + Lh - 1 output samples with no wraparound. Circular convolution treats both signals as periodic with period N and wraps the tail back to the start of the result, which only matches the linear result when N is large enough to hold the full linear output.
When does circular convolution equal linear convolution?+
Circular convolution of length N equals the true linear convolution exactly when N is greater than or equal to Lx + Lh - 1, the linear convolution's full output length. This is why FFT-based convolution always zero-pads both signals to at least that length before transforming.
What happens if my circular length N is too short?+
The last Lx + Lh - 1 - N samples of the true linear result wrap around the end of the N-length buffer and add onto the beginning, corrupting exactly that many samples at the start of the circular result. Everything from sample Lx + Lh - 1 - N onward in the circular output is still correct.
Why do FFT-based convolution implementations always zero-pad?+
Multiplying two DFTs and taking the inverse DFT always produces a circular convolution of whatever length was transformed, never a linear one directly. Zero-padding both the signal and the kernel out to at least Lx + Lh - 1 samples before the FFT is the standard trick that makes the circular result equal the desired linear result.
Why round the FFT length up to a power of 2 instead of using the exact minimum?+
The radix-2 FFT algorithm runs fastest at power-of-2 lengths. Since any N at or above Lx + Lh - 1 avoids aliasing, rounding up to the next power of 2 above that minimum gets algorithmic speed with zero extra risk of aliasing, at the cost of transforming a few unused zero samples.
Is this the same wraparound as frequency-domain aliasing from undersampling?+
No, these are two unrelated phenomena that happen to share the word 'aliasing'. Frequency-domain aliasing (covered by the Aliasing Frequency and Nyquist Sampling Rate calculators) comes from sampling a continuous signal too slowly. Circular convolution aliasing is a time-domain wraparound artifact from choosing too short a buffer for an FFT-based convolution, and has nothing to do with the original sampling rate.
Does aliasing only corrupt some samples, or the entire result?+
Only the first Lx + Lh - 1 - N samples of the circular result are corrupted when N is too short; the remaining N - (Lx + Lh - 1 - N) samples still equal the correct linear convolution values. This is why overlap-save and overlap-add block-processing methods can discard just the corrupted edge samples and keep the rest.
What is the smallest safe circular length for two given signal lengths?+
The smallest length that guarantees zero aliasing is exactly N = Lx + Lh - 1. In practice, most implementations round that up to the next power of 2 for FFT speed, which is always a safe (if slightly larger than strictly necessary) choice.
How does this relate to overlap-add block convolution?+
Overlap-add processes a long signal in fixed-size blocks, convolving each block with the filter using a circular length chosen to avoid aliasing for that single block (block length plus filter length minus 1, rounded up), then adds the overlapping tails of consecutive blocks together to reconstruct the full linear result.
Can circular convolution ever be useful even with aliasing?+
Yes, in specific contexts. Some algorithms (fast correlation, certain adaptive filters) deliberately exploit the circular wraparound behavior rather than avoiding it. But whenever the goal is to replicate ordinary linear filtering, the circular length must be chosen large enough to avoid aliasing, as this calculator checks.

What is the difference between circular and linear convolution?

Linear convolution slides a filter across a signal exactly once, producing Lx + Lh - 1 output samples with no wraparound. Circular convolution treats both signals as periodic with period N and wraps the tail back to the start of the result, which only matches the linear result when N is large enough to hold the full linear output.

When does circular convolution equal linear convolution?

Circular convolution of length N equals the true linear convolution exactly when N is greater than or equal to Lx + Lh - 1, the linear convolution's full output length. This is why FFT-based convolution always zero-pads both signals to at least that length before transforming.

What happens if my circular length N is too short?

The last Lx + Lh - 1 - N samples of the true linear result wrap around the end of the N-length buffer and add onto the beginning, corrupting exactly that many samples at the start of the circular result. Everything from sample Lx + Lh - 1 - N onward in the circular output is still correct.

Why do FFT-based convolution implementations always zero-pad?

Multiplying two DFTs and taking the inverse DFT always produces a circular convolution of whatever length was transformed, never a linear one directly. Zero-padding both the signal and the kernel out to at least Lx + Lh - 1 samples before the FFT is the standard trick that makes the circular result equal the desired linear result.

Why round the FFT length up to a power of 2 instead of using the exact minimum?

The radix-2 FFT algorithm runs fastest at power-of-2 lengths. Since any N at or above Lx + Lh - 1 avoids aliasing, rounding up to the next power of 2 above that minimum gets algorithmic speed with zero extra risk of aliasing, at the cost of transforming a few unused zero samples.

Is this the same wraparound as frequency-domain aliasing from undersampling?

No, these are two unrelated phenomena that happen to share the word 'aliasing'. Frequency-domain aliasing (covered by the Aliasing Frequency and Nyquist Sampling Rate calculators) comes from sampling a continuous signal too slowly. Circular convolution aliasing is a time-domain wraparound artifact from choosing too short a buffer for an FFT-based convolution, and has nothing to do with the original sampling rate.

Does aliasing only corrupt some samples, or the entire result?

Only the first Lx + Lh - 1 - N samples of the circular result are corrupted when N is too short; the remaining N - (Lx + Lh - 1 - N) samples still equal the correct linear convolution values. This is why overlap-save and overlap-add block-processing methods can discard just the corrupted edge samples and keep the rest.

What is the smallest safe circular length for two given signal lengths?

The smallest length that guarantees zero aliasing is exactly N = Lx + Lh - 1. In practice, most implementations round that up to the next power of 2 for FFT speed, which is always a safe (if slightly larger than strictly necessary) choice.

How does this relate to overlap-add block convolution?

Overlap-add processes a long signal in fixed-size blocks, convolving each block with the filter using a circular length chosen to avoid aliasing for that single block (block length plus filter length minus 1, rounded up), then adds the overlapping tails of consecutive blocks together to reconstruct the full linear result.

Can circular convolution ever be useful even with aliasing?

Yes, in specific contexts. Some algorithms (fast correlation, certain adaptive filters) deliberately exploit the circular wraparound behavior rather than avoiding it. But whenever the goal is to replicate ordinary linear filtering, the circular length must be chosen large enough to avoid aliasing, as this calculator checks.