Op-Amp Gain Calculator (Inverting & Non-Inverting)
The gain of an ideal op-amp stage depends only on the ratio of two resistors — never on the op-amp itself. The inverting configuration (input through R1 into the minus input) gives Av = −Rf/R1: the output is flipped and can be smaller or larger than the input. The non-inverting configuration (input directly on the plus input) gives Av = 1 + Rf/R1: the gain is always positive and at least 1.
Enter the configuration, the input voltage and the two resistors. If you enter the ±Vcc supply rails, the page flags any saturation — the output can never exceed the op-amp's supply.
The stage
The ideal op-amp model: virtual ground, no input current
Two rules, used until they fail. First: no current into the inputs. Second: with negative feedback in the linear region, the two inputs sit at the same voltage. Ground the + pin and the − pin is a virtual ground — 0 V that cannot sink current to earth, only a convenient node for the arithmetic.
Real silicon leaks nanoamps and has millivolts of offset. The ideal model is still the right first sketch for DC gain.
Deriving the gain of the inverting stage
Vin through R1 into the − pin, feedback Rf from the output, + pin grounded. Virtual ground puts the − pin at 0 V, so
I1 = Vin / R1 · Vout = − I1 · Rf = − (Rf / R1) · Vin
The minus sign is a polarity flip, not a warning. Current that cannot enter the op-amp has to leave through Rf. That is the whole derivation.
Deriving the gain of the non-inverting stage
Vin goes to the + pin. R1 to ground and Rf from the output form a voltage divider back to the − pin. Feedback forces that tap to equal Vin:
Vin = Vout · R1 / (R1 + Rf) ⇒ Av = 1 + Rf / R1
Always ≥ 1, never inverted. You cannot make a gain of 0.5 with this topology alone — that is an inverting stage, or a divider in front of a follower.
The voltage follower: a special case of the non-inverting stage (Rf=0 or R1=∞)
Short Rf, omit R1 (open). Av = 1. Vout = Vin. The point is impedance: megaohms looking in, a few ohms looking out. A sensor that would sag into a 10 kΩ load sits happily on a follower.
Unity gain is not “no op-amp”. It is the buffer.
Why the inverting stage's input impedance is limited to R1
The source sees R1 going to virtual ground. Zin = R1, full stop. Want gain of 100 and Zin of 100 kΩ? Then R1 = 100 kΩ and Rf = 10 MΩ, which is a noisy, leaky pair. The non-inverting stage does not have that fight: Zin is the op-amp's own, and the divider can be whatever the noise budget allows.
Output saturation: why Vout can never exceed the supply
The output stage is a pair of transistors hanging from the rails. Vout lives between them, minus a dropout that is 1–2 V on old 741-class parts and tens of millivolts on a rail-to-rail chip.
VCC− + Vsat ≤ Vout ≤ VCC+ − Vsat
Once the output sticks to a rail, virtual ground dies, the gain formula is fiction, and the input pair may invert (phase reversal on some older parts). Check Vin × |Av| against the available swing before you blame the resistors.
Bandwidth and gain-bandwidth product: the frequency limits
Voltage-feedback op-amps have a roughly constant gain–bandwidth product. Closed-loop gain 100, GBW 1 MHz → about 10 kHz of −3 dB bandwidth. Above that, −20 dB/decade.
f−3dB ≈ GBW / |Av| (voltage-feedback, dominant pole)
Slew rate is a different ceiling: a 1 V/µs part will not draw a 10 V, 20 kHz sine, however large GBW looks on the first page of the datasheet.
Related circuits: summing amplifier, difference amplifier, integrator, differentiator
- Inverting summer — several input resistors into the − node. Weighted sum, polarity flipped.
- Difference amplifier — both inputs used; Av · (V+ − V−) if the ratios match. Mismatch kills CMRR.
- Integrator — C in the feedback. Output is the running integral, until the capacitor charges to a rail.
- Differentiator — C in series with the input. High-frequency noise has a field day; a small series R tames it.
An analog RC time constant is often the thing sitting in that feedback loop.
Choosing Rf and R1: noise, bias current, offset
- Johnson noise — large R is noisy. A few kΩ to a few tens of kΩ is the usual playground.
- Bias current — Ib through Rf is an extra offset. Bipolar inputs hate megaohm feedback; FET inputs care less.
- Offset — Vos is multiplied by the noise gain (1 + Rf/R1, even on the inverter). A resistor equal to R1∥Rf on the unused input cancels the Ib drop on older bipolars.
- Loading — tiny R burns current in the feedback net and may overload the output.
A boring starting pair: R1 = 1–10 kΩ, Rf for the gain you actually need.
Single-supply bias and the half-rail myth
A 0–5 V op-amp cannot output −1 V. AC signals need a bias, usually VCC/2 on the + pin, with the output swinging around that midpoint. The inverting “virtual ground” is then that bias, not 0 V. Forget the bias capacitor on the + pin and the output sits in a corner, looking like a dead chip.
Slew rate versus small-signal bandwidth
GBW governs small sines. Slew rate governs how fast the output can climb, in V/µs. Full-power bandwidth is SR / (2π·Vpeak). A “1 MHz” 741 with 0.5 V/µs is a 8 kHz full-swing part. Read both numbers, or the scope will.
Why “rail-to-rail” is not infinite gain
Rail-to-rail I/O means the swing can approach the supplies, not that Av is infinite at DC or that the output can drive 0 Ω. Open-loop gain still falls with frequency, and the output current still has a datasheet limit. A follower into a heavy load will sit a few tens of millivolts off the rail and run hot. That is physics, not a counterfeit chip.
The gain formulae assume linear operation and negative feedback. If the output is against a rail, or the loop is open, virtual ground is gone and −Rf/R1 is a memory, not a measurement.