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.
🔄 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
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 — Undersized FFT Length (Common Mistake)
Lx = 8, Lh = 5, N = 8 (equal to signal length only)
Example 2 — Correctly Zero-Padded Length
Lx = 8, Lh = 5, N = 12 (the exact minimum safe length)
Example 3 — Block Convolution Buffer Check
Lx = 1,024, Lh = 64, N = 1,024
❓ Frequently Asked Questions
🔗 Related Calculators
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.