Window functions: leakage, resolution and sidelobes

Published 11 September 2026 · Updated 11 September 2026 · 12 min read

Magnitude-response illustration
A Hann window's magnitude response: one wide main lobe and descending sidelobes.

Every spectrum you have ever looked at was multiplied by a window, whether you chose one or not. Analysing a finite record means pretending the signal is zero outside it, which is the same as multiplying by a rectangle — and a rectangle has the worst spectral leakage of any window in common use. Choosing a window is therefore not an optional refinement; it is picking which artefact you are willing to live with.

The generator below builds the coefficients for eight standard windows, draws their shape and their magnitude response, and measures the four numbers that decide which one you should be using. All of the numbers are computed from the coefficients, so you can check any of them against a datasheet.

Window function generator and comparison

Pick a window and a length. Everything runs locally; the coefficient list is yours to copy out.

Definition Unchecked = periodic / DFT-even (denominator N), the right choice before a DFT.
Coherent gain
Amplitude correction (tones)
ENBW
Noise power correction
Main lobe (null to null)
Worst sidelobe

Shape in the time domain

Magnitude response

0 dB at DC, reference length 2048 points

First coefficients

Coherent gain, ENBW and the coefficient list follow the length you choose. Main lobe width and sidelobe level do not: in bin units they are properties of the window itself, so they are measured once against a reference length.

What a window actually does

Extracting N samples and analysing them is multiplication by a rectangle of length N. Multiplication in the time domain is convolution in the frequency domain, so the spectrum you see is the true spectrum convolved with the rectangle's response — a sinc function with a narrow peak and slowly decaying tails. A pure tone that does not land exactly on a bin centre therefore appears as a spike with skirts running across the whole display. That is leakage, and no amount of averaging removes it.

A window tapers the record towards zero at both ends, which narrows the tails at the cost of widening the peak. Every window in the table below is a different point on that trade-off, and the trade-off is measurable in four numbers.

The four numbers

  • Coherent gain — the mean of the coefficients, also called the amplitude gain. A Hann window has a coherent gain of exactly 0.5, so every tone in the spectrum comes out 6.02 dB low until you divide by it.
  • ENBW, the equivalent noise bandwidth — the width of the ideal rectangular filter that would pass the same amount of white noise, in bin widths. Rectangular is 1.0 by definition; flat-top is 3.77. It tells you both how much noise a bin collects and how much resolution you have surrendered.
  • Main lobe width — the distance between the first nulls either side of a tone, in bins. For a window built from K cosine terms it is exactly 2K bins, independent of the record length. This, not the record length alone, is what decides whether two nearby tones can be separated.
  • Worst sidelobe — the highest remaining lobe, in dB below the peak. It sets the dynamic range of the display: a −43 dB sidelobe means you cannot trust anything within 43 dB of a strong tone.

The comparison table

Computed from the standard coefficient sets. Amplitude correction is what you add to recover the true tone level; noise power correction is what you add to recover the true noise power from a bin reading.

Window Coherent gain Amp. corr. ENBW (bins) Noise corr. Main lobe Worst sidelobe
Rectangular1.00000.00 dB1.0000.00 dB2 bins−13.3 dB @ 1.4
Hann0.50006.02 dB1.500−1.76 dB4 bins−31.5 dB @ 2.4
Hamming0.54005.35 dB1.363−1.34 dB4 bins−42.7 dB @ 4.5
Blackman0.42007.54 dB1.727−2.37 dB6 bins−58.1 dB @ 3.5
Blackman-Harris0.35888.90 dB2.004−3.02 dB8 bins−92.0 dB @ 4.5
Nuttall0.35588.98 dB2.021−3.06 dB8 bins−93.3 dB @ 4.6
Blackman-Nuttall0.36368.79 dB1.976−2.96 dB8 bins−98.2 dB @ 6.5
Flat-top0.215613.33 dB3.770−5.76 dB10 bins−93.0 dB @ 18.5

Two corrections, not one

This is where most windowed measurements go wrong, because the two cases need different factors and the difference is easy to miss when the numbers are close.

A pure tone is spread by the window's main lobe, so its measured peak is scaled by the coherent gain. Divide by it — add 6.02 dB for Hann — and the tone level is restored exactly, provided the tone is isolated.

Broadband noise is not a single peak; it fills every bin, and the amount of noise a bin collects scales with the energy gain, which is ENBW. Recovering noise density means dividing by ENBW, not by the coherent gain. For Hann those two factors differ by 1.76 dB, which is exactly the kind of systematic error that survives a review because it is too small to look wrong.

A sanity check worth doing once: window a full-scale sine that lands exactly on a bin centre, and confirm the peak reads 0 dBFS after applying the amplitude correction and −6.02 dB without it. If the number disagrees, the correction is being applied twice or not at all.

Which window to use

  • General mixed signals and noise: Hann. Good sidelobes for the resolution, and a coherent gain of exactly 0.5 that is easy to remember.
  • Isolated tones, moderate dynamic range: Hamming. Its first sidelobe is 11 dB better than Hann's, but its sidelobes decay slowly, so it is a poorer choice when a loud tone sits far from what you are measuring.
  • Amplitude calibration: flat-top. The passband is flat enough that amplitude error stays small even for a tone halfway between bins, which is what calibration work needs. The price is 3.77 bins of ENBW and 13.33 dB of correction.
  • Wide dynamic range: Blackman-Harris, Nuttall or Blackman-Nuttall, if the difference between two tones is larger than about 60 dB and the resolution penalty of 8 bins does not matter.
  • Transients, impulses and already-synchronous signals: rectangular, because any taper would attenuate the very thing you are measuring.

Symmetric or periodic: the definition nobody mentions

The same named window comes in two definitions. In the symmetric version the denominator of the cosine argument is N − 1, which makes the window mirror-symmetric and its first and last samples equal; in the periodic (DFT-even) version the denominator is N, the last sample is the one just before the implied next period, and the window does not end at zero.

Use the periodic definition when the window is applied before a DFT, and the symmetric one when the coefficients become FIR filter taps — the topic of the FIR design article later in this series. The difference is not cosmetic: for a Hann window of length 9 the symmetric definition has a coherent gain of 8/18 = 0.4444 rather than 0.5, which moves the amplitude correction by 1.02 dB.

Five mistakes that survive review

  1. Correcting for noise when you are measuring a tone. Using ENBW in place of the coherent gain costs 1.76 dB on a Hann-windowed tone, and the result still looks plausible.
  2. Assuming the rectangular window is not a window. It is, and it has the highest sidelobe of the set at −13.3 dB. That is fine for transients and fatal for a tone that does not land on a bin.
  3. Using zero padding to gain resolution. Padding interpolates the spectrum you already have. Two tones 1 bin apart are still one lump under a Hann window no matter how many zeros you append.
  4. Expecting a longer record to lower the sidelobes. Length moves the bins closer together; it does not change the sidelobe level, which is a property of the window's shape. Only a different window does that.
  5. Mixing definitions between tools. A window generated in the symmetric convention and applied before an FFT gives a small amplitude error on every peak, which then gets blamed on the analyser.

Summary

Pick the window from the trade-off you can afford: resolution (main lobe width), leakage (worst sidelobe), and correctness of the level (coherent gain for tones, ENBW for noise). Then apply the matching correction, and state which definition of the window you used. The generator above shows all four numbers at once so the trade-off is visible rather than remembered.

Coefficients are engineering aids rather than measurements; see the disclaimer, and the tool index for the rest of the series.