How to Measure Total Harmonic Distortion (THD)

Total harmonic distortion (THD) is measured by comparing the strength of unwanted harmonic frequencies in a signal to the strength of the original (fundamental) frequency. You can do this with a spectrum analyzer, an oscilloscope paired with FFT software, or a dedicated audio analyzer, depending on whether you’re working with power systems, RF equipment, or audio gear. The core process is the same across all applications: generate or capture a signal, break it into its frequency components, and calculate how much energy sits in the harmonics relative to the fundamental.

The Basic THD Formula

THD is the ratio of the combined energy in all harmonic frequencies to the energy in the fundamental frequency. Each harmonic is a multiple of the fundamental: if your signal is 1 kHz, the second harmonic is 2 kHz, the third is 3 kHz, and so on. To calculate THD as a percentage, you take the root mean square (RMS) of all harmonic amplitudes, divide by the RMS amplitude of the fundamental, and multiply by 100.

In decibels, the formula becomes: 20 × log₁₀(RMS sum of harmonics ÷ fundamental amplitude). Decibel notation is more common in audio and RF work because it handles the large dynamic range between a strong fundamental and weak harmonics more intuitively. A THD of 1% translates to roughly -40 dB, while 0.01% is around -80 dB.

You’ll also encounter THD+N, which adds noise into the numerator alongside the harmonics. THD+N is more realistic for audio applications because it captures everything that isn’t the desired signal, not just the neat harmonic peaks. The AES17 standard for digital audio equipment uses a THD+N approach: a notch filter removes the fundamental from the output, and whatever remains (harmonics plus noise, bandwidth-limited to 20 Hz through 20 kHz) is measured as a ratio to the unfiltered signal.

Voltage THD vs. Current THD

In power systems, THD is calculated separately for voltage and current. Voltage THD (often written THDv or THDV) uses the RMS values of voltage harmonics divided by the fundamental voltage. Current THD (THDi or THDI) does the same with current harmonics. The formulas are identical in structure, but the numbers behave very differently in practice.

Voltage THD on a utility power bus tends to stay relatively low because the grid’s source impedance is small. Current THD, on the other hand, can be very high when nonlinear loads like variable-frequency drives or switching power supplies draw current in sharp pulses rather than smooth sine waves. IEEE 519-2022, the main North American standard for power quality, sets separate limits for voltage and current distortion and considers individual harmonics up to the 50th. The current limits also depend on the ratio of available short-circuit current to the facility’s demand load current at the point of common coupling, so a large industrial plant on a stiff utility connection is allowed more current distortion than a small facility on a weaker feed.

Measuring THD With a Spectrum Analyzer

A spectrum analyzer is the most direct tool for THD measurement in RF and power electronics work. You connect the device under test to the analyzer input, apply a known sine wave (from a signal generator if the device needs one), and read the amplitude of the fundamental and each harmonic from the frequency-domain display.

The analyzer’s own performance matters more than you might expect. It needs high linearity so it doesn’t generate its own harmonics internally, low noise floor so you can see weak high-order harmonics, and enough dynamic range to handle the gap between a strong fundamental and a faint fifth or seventh harmonic. If you’re measuring a device with -80 dB THD and your analyzer only has 70 dB of spurious-free dynamic range, the measurement tells you more about the analyzer than the device.

The signal generator feeding the device under test also needs to be clean. If your source has harmonics of its own, those will pass through the device and show up in the output, inflating your THD reading. Precision oscillator circuits designed for this purpose can achieve distortion below 0.003%, which is low enough for most amplifier and converter testing.

Measuring THD With an Oscilloscope

Modern digital oscilloscopes with built-in FFT (fast Fourier transform) capability can measure THD without a separate spectrum analyzer. You capture the time-domain waveform, apply the FFT to convert it into a frequency spectrum, and read the harmonic amplitudes from the resulting plot. Many oscilloscopes now have automated THD calculations that do this math for you.

The practical limitation is resolution. An oscilloscope’s analog-to-digital converter typically has 8 to 12 bits of vertical resolution, which limits how far down into the noise you can see harmonics. That’s usually fine for power electronics where THD might be a few percent, but it’s not sufficient for high-performance audio work where you need to resolve distortion at -100 dB or below.

Dedicated Audio Analyzers

For audio applications, purpose-built analyzers offer the best combination of low noise, high resolution, and measurement automation. Hardware like the QuantAsylum QA403 connects via USB, generates test tones internally, captures the output, and calculates THD and THD+N in software. These devices are designed specifically for the 20 Hz to 20 kHz audio band and typically use 24-bit converters for the dynamic range that audio distortion measurements demand.

The AES17 standard specifies a practical test procedure: stimulate the equipment with a low-distortion sine wave at several amplitude and frequency combinations (including near full scale at 41 Hz, 997 Hz, and 6597 Hz, plus lower levels at 997 Hz down to -60 dBFS), remove the fundamental with a notch filter, and measure everything that’s left. Running measurements at multiple levels matters because distortion behavior often changes with signal amplitude. Some devices distort more at high levels (clipping), while others show rising distortion at very low levels where noise dominates.

Getting Accurate Results With FFT

Whether you’re using an oscilloscope, a dedicated analyzer, or software on a PC, most modern THD measurements rely on the discrete Fourier transform (DFT), usually implemented as the FFT algorithm. Two problems can quietly corrupt your results if you’re not careful: spectral leakage and aliasing.

Spectral leakage happens when the signal you’re analyzing doesn’t fit perfectly into your measurement window. If your capture contains exactly 10 complete cycles of the fundamental, each harmonic lands neatly in a single frequency bin. If it contains 10.3 cycles, the energy from each harmonic smears across neighboring bins, making weak harmonics harder to distinguish from the skirts of stronger ones. The fix is either to synchronize your sample rate to the signal frequency (coherent sampling) so you capture whole cycles, or to apply a window function that tapers the edges of the captured data to reduce the smearing. Hann and flat-top windows are common choices, each trading off frequency resolution against amplitude accuracy.

Aliasing occurs when harmonics above half your sample rate fold back into the spectrum and masquerade as lower-frequency components. If you’re sampling at 48 kHz, any harmonic above 24 kHz will alias. For a 1 kHz fundamental, that means the 25th harmonic and above could contaminate your measurement. An anti-aliasing filter before the digitizer handles this, but you should verify it’s doing its job, especially if you’re measuring signals with sharp edges that are rich in high-order harmonics.

Recent research has shown that windowing itself introduces additional aliased components beyond the simple negative-frequency mirror that textbooks describe. These extra aliased bands have a decreasing but non-negligible effect on accuracy, which partly explains why even carefully executed DFT-based measurements hit an accuracy ceiling. Converting the captured signal to its analytic form (removing the negative-frequency content before analysis) and using a rectangular window can push noise-limited accuracy close to the theoretical minimum.

Practical Steps for a Clean Measurement

Start with your signal source. If you’re testing an amplifier, filter, or converter, the input sine wave needs to have THD at least 10 dB lower than what you expect from the device. Otherwise, you’re measuring the source, not the device. For power system measurements where you’re analyzing the existing line voltage or load current, this isn’t a concern since the grid itself is your source.

Match your measurement bandwidth to your application. Audio work typically covers 20 Hz to 20 kHz. Power quality measurements under IEEE 519 consider harmonics up to the 50th, which for a 60 Hz system means you need to resolve frequencies up to 3 kHz. RF amplifier testing might require bandwidth into the megahertz range to catch harmonics far from the fundamental.

Use enough averaging. A single FFT snapshot is noisy. Most analyzers let you average multiple captures to smooth the noise floor and get a more repeatable reading. For THD+N measurements, this also helps separate the deterministic harmonic peaks from the random noise, giving you a clearer picture of each contribution.

Check your cabling and grounding. Ground loops can inject 50 or 60 Hz hum and its harmonics into your measurement path, and those will show up in your THD number. Shielded cables, balanced connections, and star grounding all help. If you see unexpected harmonics of the mains frequency that don’t change when you adjust the device under test, the problem is in your setup, not your device.