Understanding the op-amp gain calculator — concept and principle
An op-amp with two resistors is the most common amplifier stage, used in sensor front ends, audio preamps and active filters. This calculator gives the voltage gain of the inverting and non-inverting configurations for a feedback resistor Rf and input resistor Rin, the output voltage for a given input, and the gain in decibels.
How it is calculated
- Inverting gain: A = −Rf / Rin; output V_out = −(Rf / Rin) × V_in.
- Non-inverting gain: A = 1 + Rf / Rin; output V_out = (1 + Rf / Rin) × V_in.
- Gain in dB: inverting 20 log₁₀(Rf / Rin) (magnitude) and non-inverting 20 log₁₀(1 + Rf / Rin).
In every case the output cannot swing beyond the supply rails.
The principle
An ideal op-amp has enormous open-loop gain, so with negative feedback it adjusts its output until the voltage difference between its two inputs is essentially zero (the "virtual short"), while drawing no input current. In the inverting circuit the inverting input sits at 0 V, so the input current V_in / Rin must flow through Rf, giving V_out = −Rf × V_in / Rin. In the non-inverting circuit the inverting input must equal V_in, and Rf and Rin form a divider from the output, so V_out × Rin / (Rin + Rf) = V_in, which rearranges to 1 + Rf / Rin. The gain therefore depends on resistor ratios, not on the op-amp's unstable internal gain.
Worked example
- Ratio: Rf / Rin = 100,000 / 10,000 = 10.
- Inverting gain: −10; output: −10 × 0.1 V = −1 V.
- Non-inverting gain: 1 + 10 = 11; output: 11 × 0.1 V = 1.1 V.
- Gain in dB: inverting 20 log₁₀(10) = 20 dB; non-inverting 20 log₁₀(11) = 20.8278537 dB.
| Input R (Ω) | Inverting gain |
|---|---|
| 2,500 | -40 |
| 5,000 | -20 |
| 7,500 | -13.33333333 |
| 10,000 | -10 |
| 12,500 | -8 |
| 15,000 | -6.666666667 |
| 20,000 | -5 |
How to read the result
A negative gain means the output is inverted (a 180° phase shift for AC signals). The inverting stage's input resistance equals Rin, so a low Rin loads the source; the non-inverting stage has very high input resistance. Bandwidth falls as gain rises: closed-loop bandwidth is roughly the op-amp's gain-bandwidth product divided by the noise gain, 1 + Rf / Rin, which is 11 here for both circuits.
Common mistakes
- Expecting an output larger than the supply allows; a ±5 V supply cannot deliver 8 V.
- Forgetting that a single-supply op-amp needs a bias point for AC signals.
- Mixing up the two dB rows: 20 dB belongs to the inverting gain of −10, 20.83 dB to the non-inverting gain of 11.
Frequently asked questions
Why is the inverting amplifier's gain negative?
The input current flows into the virtual-ground node and out through Rf, so the output must go below 0 V when the input is positive.
How do I get a gain of exactly 1?
Use a voltage follower: the non-inverting circuit with Rf = 0 and Rin left open gives gain 1 with very high input impedance.
Sources: Horowitz and Hill, The Art of Electronics, 3rd edition, chapter on operational amplifiers · Texas Instruments, Op Amps for Everyone (Ron Mancini, editor)