Total harmonic distortion (THD) calculator
Type the amplitude of the fundamental first, then the 2nd, 3rd and further harmonics, in any one unit (V, mV, A), or their levels in dB from a spectrum analyser or FFT. The calculator gives the total harmonic distortion relative to the fundamental and to the total signal.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Enter the amplitude of the fundamental, then the harmonics in order: 2nd, 3rd, 4th and so on.
- Choose whether the numbers are amplitudes (all in one unit) or levels in dB.
- Read THD in percent and dB, THD-R, and each harmonic as a percentage of the fundamental (H2, H3, …).
Skip nothing in the order: if a harmonic is not visible, enter 0 (or a very low dB level) so the next ones keep their numbers.
- THD (THD-F): √(V2² + V3² + … + Vn²) / V1.
- THD-R: √(V2² + … + Vn²) / √(V1² + V2² + … + Vn²).
- In dB: 20 × log10(THD).
- From dB levels: V = 10^(L / 20), then the same formulas.
Worked example
Fundamental 1,000 mV, harmonics 100, 50 and 20 mV:
- sum of squares 100² + 50² + 20² = 12,900, square root 113.578 mV;
- THD = 113.578 ÷ 1,000 = 11.3578 %, or 20 × log10(0.113578) = −18.89 dB;
- THD-R = 113.578 ÷ √(1,000,000 + 12,900) = 11.2853 %;
- H2 = 10 %, H3 = 5 %, H4 = 2 %.
From an FFT: fundamental 0 dB, H2 −40 dB, H3 −50 dB give THD = √(0.01² + 0.00316²) = 1.0488 %.
Tips and common mistakes
- Do not mix RMS and peak values; the ratio is the same either way as long as all values use the same one.
- Watch the window and bin. FFT leakage spreads each harmonic over several bins; use the peak of each.
- How many harmonics? Power quality work often counts up to the 40th or 50th; audio tests usually stop at the edge of the audio band.
Frequently asked questions
How is THD calculated?
THD is the RMS sum of the harmonics divided by the fundamental: THD = √(V2² + V3² + V4² + …) / V1. With a 1 V fundamental, 0.1 V second and 0.05 V third harmonic, THD = √(0.01 + 0.0025) = 0.1118, or 11.18 %.
What is the difference between THD-F and THD-R?
THD-F divides by the fundamental, THD-R by the RMS of the whole signal (fundamental plus harmonics). They are almost equal for low distortion; THD-R can never exceed 100 %, THD-F can. Most specifications mean THD-F.
How do I convert THD between percent and dB?
THD in dB = 20 × log10(THD as a fraction). 1 % is −40 dB, 0.1 % is −60 dB and 10 % is −20 dB.
Can I enter levels from an FFT in dBV or dBFS?
Yes. Choose levels in dB and type the fundamental's level first. Any reference works, because each level is turned into a linear amplitude with 10^(L/20) and the reference cancels in the ratio.
Is THD the same as THD+N?
No. THD+N includes the noise in the measurement band as well as the harmonics, so it is always higher. This calculator uses only the harmonic amplitudes you enter.