Pump a pure sine wave into a system and any energy that comes out at frequencies other than the input is distortion. Total Harmonic Distortion (THD) measures the integer-multiple harmonics — H2 at twice the fundamental, H3 at three times, etc. — and reports their combined RMS level as a fraction of the fundamental. THD+N adds wideband noise into the same fraction, so it's always larger than THD. These distortion measurement metrics are the primary tools audio engineers use to characterize and compare audio quality across devices.
The formula
For a fundamental amplitude H1 and harmonic amplitudes H2, H3, ..., Hn (in linear units, not dB):
THD = √(H2² + H3² + … + Hn²) / H1
Expressed either as a percentage (0.01% ≈ -80 dB) or in dB (20·log10 of the ratio). The tool computes both.
Even vs odd harmonics — and why tubes sound nice
Symmetric clipping (a hard limiter clipping equally top and bottom) produces only odd harmonics — H3, H5, H7… A square wave is the limit case (all odd, amplitudes 1/n) and ironically has the highest THD of any standard waveform (~48%). Asymmetric distortion — tube saturation in a class-A stage running into soft compression, or a class-A transistor amp warming up — produces predominantly even harmonics: H2, H4, H6. Even harmonics are musically consonant (H2 is an octave above the fundamental) and add a "warm" character, while odd harmonics (H3 is a perfect fifth, H5 is a major third) become harsh once they're loud. That's why a 5% THD tube amp can sound "musical" while a 1% transistor amp at the same crossover region sounds "edgy". To see the full harmonic spectrum behind any signal — not just the distortion components — try the harmonic overtone detector, which resolves H1 through H16 in real time.
Standards in the wild
Hi-end audiophile DAC: −120 dB THD+N (0.0001%) — limited by the analog reconstruction filter, not the digital path. Pro studio mic preamp: −86 dB (0.005%). Consumer hi-fi amp (IEC 60268-3): typically < 0.01% at rated power. Broadcast audio: 0.1% is the practical limit, more often 0.03%. Telephone (G.712 narrowband): up to 2% is acceptable. Tube guitar amp at clean: 0.5–2%. Overdrive pedal: 20% and up — that's the feature, not the bug. When designing or evaluating amplifier stages you may also want to use the FFT frequency analyzer to verify spectral flatness outside the harmonic region.
Why mic mode can be wrong
The live-mic mode picks the nearest FFT bin to each integer multiple of your test frequency and reads its dB. That assumes (a) the mic doesn't add its own distortion (cheap USB mics do — at high SPL their THD can swamp the device under test), (b) your speakers are clean (most aren't above 90 dB SPL), (c) the room isn't adding reflections that change the harmonic phasing. For real measurement work, use a dedicated audio analyzer (Audio Precision, RME ADI-2, dscope) and a calibrated electrical loopback path, not a microphone in a room. This tool is for illustration and rough sanity checks, not certification. Room acoustics and speaker non-linearity are separate concerns; the audio spectrum analyzer can help you assess background noise and room coloration before you begin a THD capture.
Intermodulation distortion vs THD
THD tests one-frequency-at-a-time. Intermodulation distortion (IMD) uses two (or more) simultaneous tones and measures difference-frequency and sum-frequency products — the SMPTE standard uses 60 Hz + 7 kHz at 4:1 amplitude. A system can have low THD but high IMD if it has memory effects (such as crossover distortion in class-B output stages that only shows up under transient loading). For a complete audio quality picture you need both metrics. This tool focuses on single-tone THD; IMD requires a two-tone generator and is beyond its scope.
Why is THD+N always worse than THD?
THD+N includes wideband noise — hiss from the amp, thermal noise from resistors, hum, room noise via the mic — in addition to harmonics. THD-only ignores everything that isn't an integer multiple of the fundamental. A clean hi-fi amp might be −95 dB THD but only −85 dB THD+N because the residual noise floor lives at −85 to −90 dB. For DAC measurements specifically, THD+N is the headline spec because noise dominates over harmonics in good designs.
Does the tool really compute everything from just dB inputs?
Yes — manual mode is pure math. You enter each harmonic's level in dB relative to the fundamental, the tool converts each to a linear ratio (10^(dB/20)), squares them, sums, takes the square root, and divides by the fundamental (which is always 1.0 in linear after normalisation). It's the same formula used in measurement gear; the difference is the gear extracts those harmonic levels automatically while here you enter them by hand or capture them live.
Why does my measured THD jump around so much in live mode?
Several things are happening: (1) The mic itself adds distortion that overlaps with the device under test. (2) Your speakers produce harmonics at SPLs you'd be unwise to subject your hearing to. (3) Room reflections cause the harmonic amplitudes to vary with mic position. (4) The FFT samples a finite window — small changes in your input level or mic gain shift bin energies. For stable measurements you need a calibrated electrical loopback (line-out → device under test → line-in), not an acoustic path.
Why does the "ideal square wave" preset show 48.3% THD?
A square wave's Fourier series has amplitude 1/n for the n-th harmonic and only odd n: 1, 1/3, 1/5, 1/7, … The sum-of-squares = π²/8 − 1 ≈ 0.2337. Square root ≈ 0.4833 = 48.3%. The preset uses the first ten odd harmonics with the right amplitudes and effectively-zero values for the even ones, so you see exactly that result. (The series technically extends to infinity, but H11 onwards contributes < 1% additional THD.)
What's a "Bandwidth-limited THD" measurement?
Real measurements specify a bandwidth (typically 22 kHz or 80 kHz) because higher harmonics above the audio band don't contribute to perceived distortion but can dominate a wideband measurement. AES17 specifies a 22 kHz brick-wall filter for THD+N. This tool effectively bandwidth-limits at the Nyquist frequency (half your sample rate) — any harmonic above that is invisible to the FFT. For mic mode at 48 kHz, harmonics above 24 kHz are dropped from the calculation; that's a 24× margin over the audible upper limit, fine for music-band measurements.
Can THD predict how something sounds?
Only loosely. THD aggregates all the harmonics into one number, but a 1% THD that's all H2 sounds completely different from a 1% THD that's all H7. The bar chart matters more than the headline number — look at the spectrum shape. Audio engineers complement THD with intermodulation distortion (IMD), interchannel crosstalk, and frequency response measurements because no single number captures perceived quality. THD is the easiest to compute and the most-quoted; treat it as a sanity floor, not a verdict.
Is my mic audio uploaded?
No. Web Audio reads the mic locally; signal goes mic → AnalyserNode → FFT, never to any server. The browser asks once for mic permission; you can revoke it any time from site permissions.
What is the difference between THD and SINAD?
SINAD (Signal-to-Noise-and-Distortion) is the inverse of THD+N expressed in dB: SINAD = −THD+N(dB). A DAC spec of "100 dB SINAD" corresponds to "−100 dB THD+N" or roughly 0.001%. ADC and DAC datasheets favour SINAD because it combines both noise and harmonic distortion in a single figure-of-merit and scales naturally with effective number of bits (ENOB ≈ (SINAD − 1.76) / 6.02). This tool's THD+N readout in dB is directly comparable to a SINAD figure — just negate the sign.
How do I calculate THD in dB from a percentage?
Convert with: THD(dB) = 20 × log₁₀(THD%). So 1% THD = 20 × log₁₀(0.01) = −40 dB. 0.01% = −80 dB. 0.001% = −100 dB. The tool shows both representations simultaneously. Note that some older datasheets quote THD as a voltage ratio (not percentage) — multiply by 100 before applying the formula. Working in dB is convenient because you can directly compare the harmonic levels on the bar chart against the −40 dB, −60 dB, −80 dB thresholds that correspond to 1%, 0.1%, and 0.01% THD respectively.
At what test level should I run a THD measurement?
Industry convention is to measure at or near rated output power — typically 1 W into 8 Ω for amplifiers, or 0 dBFS for digital devices. At very low levels, noise dominates THD+N and makes the amplifier look worse than it is; at clipping, THD spikes and is unrepresentative of normal use. IEC 60268-3 specifies measurement at the reference test level, which is usually 1 dB below clipping. For mic-mode measurements here, set your generator to a comfortable SPL (70–80 dB SPL at the mic) so the ADC isn't near saturation and the microphone capsule stays below its own distortion onset.