Gain Margin Calculator
Find how much extra loop gain a feedback system can take before it goes unstable — convert between the magnitude at the phase crossover, the gain margin in × and dB, and optionally derive everything from a type-1 open-loop transfer function.
Scales the loop gain by a multiplier k and plots the remaining margin in dB. Every doubling of gain costs 6.02 dB, and the line crosses 0 dB at k = GM, which is exactly where the closed loop becomes marginally stable. The dashed 6 dB line is the common minimum design target.
Magnitude (teal, left axis) and phase (amber, right axis) of G(s) = K / [s(τ₁s+1)(τ₂s+1)]. The red markers sit at the phase crossover ωpc where phase = −180°. The gap between the magnitude curve and the 0 dB line at that frequency is the gain margin.
Left: the gain margin is the vertical distance from the 0 dB line down to the magnitude curve, measured at the phase crossover ωpc. Right: on the Nyquist plot the curve crosses the negative real axis at −1/GM. The closer that crossing sits to the critical point −1, the smaller the margin.
| GM (×) | GM (dB) | |G(jωpc)| |
|---|---|---|
| 1.00 | 0 dB | 1.000 |
| 1.41 | 3.01 dB | 0.707 |
| 2.00 | 6.02 dB | 0.500 |
| 3.16 | 10.0 dB | 0.316 |
| 5.00 | 13.98 dB | 0.200 |
| 10.0 | 20.0 dB | 0.100 |
| GM | Reading |
|---|---|
| < 0 dB (GM < 1) | Unstable closed loop |
| 0 dB (GM = 1) | Marginally stable, sustained oscillation |
| 0 – 6 dB | Low margin, fragile to gain changes |
| 6 – 12 dB | Typical design target |
| > 12 dB | Conservative, very robust to gain error |
Conversions: GM(dB) = 20·log₁₀(GM), and |G(jωpc)|(dB) = −GM(dB). Gain margin is usually paired with a phase margin of 30° to 60°.
Loop gain K ↑
Raising K scales |G| up everywhere, so GM falls in proportion. Doubling K removes 6.02 dB of margin.
More lag or delay
Extra lag, delay or slower poles pull the phase crossover to a lower frequency where the gain is higher, shrinking the margin.
Lead compensation
A lead network adds phase near crossover, which pushes the phase crossover out to higher frequency and improves the margin.
What Is Gain Margin?
Gain margin is a stability measure for a feedback loop. It tells you by what factor the open-loop gain could increase before the closed loop becomes unstable. A gain margin of 2 (6 dB) means you could double the loop gain and still sit on the edge of stability. It guards against gain errors, component tolerances and modelling uncertainty.
The Gain Margin Formula
Here ωpc is the phase crossover frequency, the frequency where the open-loop phase equals −180°. At that frequency a loop gain of exactly 1 would feed back in perfect opposition and sustain an oscillation, so the margin is how far |G| sits below 1 there. If |G(jωpc)| is 0.5, GM is 2. The result is valid for a loop that is stable in open loop with a single phase crossover.
How to Calculate Gain Margin
Read |G(jωpc)| from a Bode plot at the frequency where the phase crosses −180°, enter it in × or dB, and the calculator returns the margin in both forms. You can also enter a known gain margin to get the magnitude back.
| Solve for | Formula |
|---|---|
| GM | GM = 1 / |G(jωpc)| |
| |G(jωpc)| | |G(jωpc)| = 1 / GM |
| GM in dB | GMdB = 20·log₁₀(GM) = −|G(jωpc)|dB |
| Critical gain Kc | Kc = GM · K (the gain at which the loop turns marginally stable) |
Gain Margin Formula Variables
| Symbol | Meaning |
|---|---|
| GM | Gain margin, as a ratio (×) or in decibels |
| G(jω) | Open-loop frequency response of the loop |
| ωpc | Phase crossover frequency, where ∠G(jω) = −180° |
| |G(jωpc)| | Open-loop magnitude at the phase crossover |
| K, Kc | Current loop gain and the critical gain at which GM = 1 |
| τ₁, τ₂ | Time constants of the example plant used for the derive option |
Deriving the Margin from G(s)
For the common type-1 loop G(s) = K / [s(τ₁s+1)(τ₂s+1)], the phase is −90° − arctan(ωτ₁) − arctan(ωτ₂). Setting that to −180° gives ωpc = 1/√(τ₁τ₂). Substituting back, |G(jωpc)| = K·τ₁τ₂/(τ₁+τ₂), so GM = (τ₁+τ₂)/(K·τ₁τ₂) and the critical gain is Kc = 1/τ₁ + 1/τ₂. Turn on the derive option in Advanced mode to compute these and see the Bode plot.
Gain Margin vs. Phase Margin
The two margins check stability from different angles. Gain margin asks how much gain error the loop tolerates at the phase crossover, while phase margin asks how much extra phase lag it tolerates at the gain crossover, where |G| = 1. A robust design checks both, since a loop can have a healthy gain margin and a thin phase margin, or the reverse.
Gain Margin Calculation Example
ωpc = 1/√(1 × 0.5) = 1.414 rad/s
|G(jωpc)| = 2 × 1 × 0.5 / 1.5 = 0.667 → GM = 1.5 × = 3.52 dB
Kc = 1/1 + 1/0.5 = 3, so the loop gain can rise from 2 to 3 before instability (a 50% increase)
Frequently Asked Questions
A positive GM in dB means |G(jωpc)| is below 1, so the loop gain is too small to sustain oscillation at the phase crossover. Negative dB means |G| exceeds 1 there and the closed loop is unstable. This holds for typical loops that are stable in open loop.
Then there is no phase crossover and the gain margin is infinite, as with a first- or second-order loop whose phase stays above −180°. Gain alone cannot destabilise it, though real delays and unmodelled dynamics usually add lag at high frequency.
Six dB (a factor of 2) is a widely used rule of thumb, often quoted alongside a phase margin of about 45°. The right target depends on how uncertain your plant model is and how costly instability would be, so safety-critical loops often demand more.
Yes, for conditionally stable systems that are stable only within a band of gains, where reducing the gain causes instability. For those, the simple GM = 1/|G(jωpc)| rule does not tell the whole story and you should inspect the Nyquist plot.
Only for the type-1 example G(s) = K / [s(τ₁s+1)(τ₂s+1)] in derive mode. For any other loop, find ωpc on a Bode plot or with software, read |G(jωpc)|, and enter it directly in basic mode.
What it means
Gain margin (GM) is the amount by which the gain of a control system can be increased before it becomes unstable. It is defined as GM = 1 / |G(jω_pc)|, where ω_pc is the phase crossover frequency (where the phase is −180°). A positive gain margin (in dB) indicates stability. A gain margin of 6 dB is typically considered acceptable. Gain margin is measured from the Bode plot. Example: If at the phase crossover frequency, the magnitude is 0.5 (i.e., −6 dB), then GM = 1/0.5 = 2 (or 6 dB). This means the gain can be doubled before the system becomes unstable. A higher gain margin provides more robustness.
Worked example
Gain Margin – Practical Example
Real‑World| Parameter | Value |
|---|---|
| |G(jωpc)| | 0.5 |
| Formula | GM = 1 / |G(jωpc)| |
Common mistakes
Watch unit consistency and the assumptions behind the formula; misapplying it outside its valid conditions is the most frequent error.Applications
Gain margin GM = 1/|G(jω_pc)| is the amount of gain increase before instability, based on the phase crossover frequency. It is used in frequency‑domain stability analysis, along with phase margin. Engineers use it to ensure robust stability in the presence of uncertainties. This is a key metric in control system design.
- Control system stability and robustness assessment
- Loop gain design and compensation
- Frequency response analysis (Bode, Nyquist)
- System performance and tolerance analysis
- Educational understanding of gain margin
Related calculators · Control Systems
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.