Op amp gain calculator
The closed-loop gain of a non-inverting, inverting or follower stage from its two resistors, or the feedback resistor a target gain needs, rounded to a value you can buy. With the output it gives for your input, whether that output clips against the rails, what the source sees as input impedance, and the bandwidth the op amp's gain-bandwidth product leaves.
Non-inverting drives the + input and returns R_G to ground: gain 1 + R_F/R_G, never below 1, and the source sees the op amp's own input. Inverting drives R_IN into the − input and grounds the + input: gain −R_F/R_IN, any magnitude, and the source sees R_IN. The follower is the non-inverting stage with R_F shorted and R_G left out.
Read the gain a resistor pair gives, or work from the gain you need to the feedback resistor, rounded to a value you can buy.
Ground resistor R_G, from the − input to ground (SBOA092's R_I). Only the ratio R_F/R_G sets the gain; the absolute values set the current the output drives into the pair, and the resistance the − input's bias current works against.
Feedback resistor R_F, from the output back to the − input. SBOA092 calls it R_O. SBOA092 puts typical input and feedback resistors between 1 kΩ and 1 MΩ.
The input voltage, DC or the instantaneous value of a signal: the peak of a sine, the top of a sensor range. Negative values are allowed.
The op amp's positive supply rail.
The negative supply rail: 0 for a single supply, −15 for ±15 V. An inverting stage on a single supply cannot swing below this, so a positive input drives it straight into the rail.
How close the output gets to V+, from the datasheet's output swing specification at your load current. Tens of mV for a rail-to-rail output; SBOA092's ±15 V example saturates at ±13.5 V, a 1.5 V headroom.
How close the output gets to V−, likewise. Many single-supply parts swing closer to the negative rail than the positive one, so the two often differ.
Gain-bandwidth product from the datasheet, MHz. The closed-loop bandwidth is roughly this divided by the noise gain. Enter 0 to skip.
DC open-loop gain from the datasheet, dB — often 100 dB to 130 dB for precision parts. Sets how far the real gain falls short of the resistor ratio. Enter 0 to skip.
- Closed-loop gain, 1 + R_F/R_G
- 11.0 V/V · 20.83 dB
- Output for 250 mV in
- 2.75 V
- Output swing, V_OL to V_OH
- 50.0 mV to 3.25 V
- Input range before the output clips
- 4.55 mV to 295 mV
- Input impedance
- very high · the op amp's own input, raised by the loop gain
- Op amp inputs sit at
- 250 mV · V_IN: check the common-mode range
- Noise gain · bandwidth at 1.00 MHz GBW
- 11.0 · 90.9 kHz
- Gain with 100 dB open-loop gain
- 10.9988 V/V (−0.0110 %) · loop gain 79.2 dB
How this is calculated
Standard: TI SBOA092 — Handbook of Operational Amplifier Applications (Carter, Brown); TI SLOA011 — Understanding Operational Amplifier Specifications; TI SBOA626 — Operational Amplifier Stability Theory and Compensation Methods
- Non-inverting stage, SBOA092 figure 14, written there as E_O = (1 + R_O/R_I)·E_I. R_F and R_G form a divider because no current flows into the inverting input, and its tap must equal V_IN. The gain "can be any desired value above unity"; the voltage follower is the R_F = 0 case, gain 1.
- Inverting stage, SBOA092 figure 17 (E_O/E_I = −R_O/R_I). The inverting input is a virtual ground, so "the driving source effectively 'sees' R_I as the input impedance". The non-inverting stage's input impedance SBOA092 idealises as infinite.
- Feedback factor, SLOA011 eq 13 and 26 and SBOA626 eq 9, the same for both stages. Its reciprocal is the noise gain, "the gain seen by a signal source at the noninverting input" (SBOA626 §4.4). For the inverting stage it is 1 + |G|, not |G|.
- Constant gain-bandwidth approximation, SBOA092 figures 33 and 34 and SLOA011 eq 37 (GBW = A_VD × f): the closed-loop gain is limited to the open-loop gain wherever the latter is smaller. The noise gain, not the signal gain, sets it. SBOA092: the unity-gain inverter's bandwidth "is decreased by one octave (50%) from that of the voltage follower".
- Finite open-loop gain, SLOA011 eq 16 and 25, for both stages. SBOA092's fuller µ (p. 27–28) adds the op amp's input and output impedance and reduces to this when they are ideal; its own ×10 example gives −9.987, "accurate to within 0.13%".
- Clipping. SBOA092: "voltage levels above the saturation voltage cannot be achieved". SLOA011 §5.6 names the swing limits V_OH and V_OL and notes they depend on the load; h₊ and h₋ are the datasheet's headroom to each rail.
- SBOA092 p. 31: "a gain of 10 is 20 dB, a gain of 100 is 40 dB". The sign of an inverting gain is phase and does not appear in dB.
Assumptions
- A voltage-feedback op amp. A current-feedback part sets its bandwidth and stability through R_F itself, and SBOA092 says to use the datasheet value.
- Resistive R_F and R_G. Capacitors in either position make the gain a function of frequency; SBOA092 figure 20 generalises the inverting stage to Z_O/Z_I, and the active filter calculator covers that case.
- The bandwidth is a single-pole, small-signal estimate from the gain-bandwidth product. Large output swings meet the slew rate first, and phase margin and peaking are not modelled.
- The finite-gain correction uses the DC open-loop gain. Open-loop gain falls with frequency, so the correction is a lower bound on the error of an AC signal.
- The output swing is taken as a fixed headroom to each rail, which is how datasheets specify V_OH and V_OL at a stated load. Heavier loads lose more headroom.
- The non-inverting stage's input must also stay inside the op amp's input common-mode range. The calculator warns when V_IN is outside the rails but does not know the part's range.
- Standard values come from IEC 60063 E24 and E96, rounded in log distance. Resistor tolerance is not included in the reported gain error.
What sets an op amp's closed-loop gain
Two resistors, and nothing else, as long as the op amp is close enough to ideal. TI's Handbook of Operational Amplifier Applications(SBOA092) derives both basic stages from two rules it calls the summing point restraints: "No current flows into either input terminal of the ideal operational amplifier", and "When negative feedback is applied around the ideal operational amplifier, the differential input voltage approaches zero." Everything on this page follows from those two sentences, applied to two ways of wiring the same pair of resistors.
Non-inverting. The signal drives the + input. The output returns to the − input through RF, and RGgoes from the − input to ground. SBOA092's reasoning: "Since no current flows into the inverting input, RO and RI form a simple voltage divider" (the handbook's names for RF and RG), and the − input must sit at the same voltage as the + input. The output therefore settles wherever the divider hands VINback to the − input, which is G = 1 + RF/RG. The gain "can be any desired value above unity", never below it, and the stage never inverts.
Inverting. The + input is grounded, and the signal arrives at the − input through RIN. Because the − input is held at ground potential by the feedback, the current through RIN is VIN/RIN. None of it can enter the op amp, so all of it flows on through RF, and the output has to go to −VIN·RF/RIN to carry it. The gain is G = −RF/RIN: any magnitude, including less than one, always with the sign flipped.
Follower. Short RF and remove RG, and the non-inverting stage has a gain of exactly 1. SBOA092 redraws the non-inverting stage to make the point that "the voltage follower is simply a special case of the non-inverting amplifier". It adds that "any arbitrary (but finite) resistance may be placed in the feedback loop without changing the properties of the ideal circuit", since no current flows through it. That is true of a voltage-feedback op amp. A current-feedback part is the exception: the handbook warns that its stability "is dependent entirely on the value of feedback resistor selected", and the datasheet value is the one to use.
The two stages differ most in what the source sees. In the non-inverting stage it drives an op amp input, which SBOA092 idealises as infinite impedance. In the inverting stage, "the driving source effectively 'sees' RI as the input impedance", because RIN is connected to a virtual ground. So an inverting stage with a 1 kΩ RIN loads its source with 1 kΩ, whatever the op amp.
Both stages also share one number that does not appear in either gain formula. The divider from the output back to the − input is the same RF and RG in both, so both have the same feedback factor β = RG/(RG + RF), "the portion of the output that is fed back to the input" in the words of TI's SLOA011. Its reciprocal, 1 + RF/RG, is the noise gain, which SBOA626 defines as "the gain seen by a signal source at the noninverting input". For a non-inverting stage it equals the signal gain. For an inverting stage it is one more than the signal gain's magnitude. The bandwidth, the finite-gain error and every DC error depend on the noise gain, not the signal gain. The calculator reports both.
Op amp gain resistor chart
Common gains, each built from a pair of E24 values. For every one, a search in the calculator's own code tries all 24 values of RG (or RIN) from 1 kΩ to 9.1 kΩ, rounds RF to the nearest E24 value for each, and keeps the pair with the smallest gain error. A ratio repeats every decade, so multiply both resistors by 10 to move the pair up a decade. The gain does not change, and the inverting stage's input impedance rises with RIN.
| Stage | Target | RG / RIN | RF | Gain, actual | Error | dB |
|---|---|---|---|---|---|---|
| Non-inverting | 2 | 1 kΩ | 1 kΩ | 2.000 | exact | 6.02 |
| Non-inverting | 5 | 3 kΩ | 12 kΩ | 5.000 | exact | 13.98 |
| Non-inverting | 10 | 2 kΩ | 18 kΩ | 10.00 | exact | 20.00 |
| Non-inverting | 20 | 4.3 kΩ | 82 kΩ | 20.07 | +0.35 % | 26.05 |
| Non-inverting | 50 | 6.8 kΩ | 330 kΩ | 49.53 | −0.94 % | 33.90 |
| Non-inverting | 100 | 1 kΩ | 100 kΩ | 101.0 | +1.00 % | 40.09 |
| Inverting | −1 | 1 kΩ | 1 kΩ | −1.000 | exact | 0.00 |
| Inverting | −2 | 1 kΩ | 2 kΩ | −2.000 | exact | 6.02 |
| Inverting | −10 | 1 kΩ | 10 kΩ | −10.00 | exact | 20.00 |
| Inverting | −100 | 1 kΩ | 100 kΩ | −100.0 | exact | 40.00 |
The inverting gains all come out exact, because E24 contains every ratio of 1, 2, 10 and 100. The non-inverting column is harder, because the stage needs RF/RG = G − 1. A gain of 10 wants a ratio of 9, which 2 kΩ and 18 kΩ give exactly. A gain of 100 wants 99, and no E24 pair in the decade gets closer than a ratio of 100. That is why a ×100 non-inverting stage built from 1 kΩ and 100 kΩ sits 1 % high. Rounding error is systematic, not random, so it adds straight onto the resistors' tolerance. With E96 values the misses shrink to +0.13 % for ×20 (1.13 kΩ and 21.5 kΩ), −0.14 % for ×50 (2.8 kΩ and 137 kΩ) and −0.74 % for ×100 (1.15 kΩ and 113 kΩ).
The dB column is 20·log10|G|, as SBOA092 defines it for the Bode plot: "a gain of 10 is 20 dB, a gain of 100 is 40 dB". An inverting stage and a non-inverting stage of the same magnitude have the same dB figure. The minus sign is a phase, and the dB scale does not show it.
Worked example: a 250 mV sensor into a 3.3 V ADC
These are the calculator's defaults. A sensor produces 0 V to 250 mV, and an ADC on a single 3.3 V supply wants to see most of its full scale. The op amp has a rail-to-rail output that gets within 50 mV of either rail, a 1 MHz gain-bandwidth product and 100 dB of open-loop gain. It is wired as a non-inverting stage with RF = 47 kΩ and RG = 4.7 kΩ. SLOA011 names this exact situation as the one where output swing becomes a design issue: "single supply systems where the op amp is used to drive the input of an analog-to-digital converter".
G = 1 + 47k / 4.7k = 11.0 V/V (20.83 dB)
V_OUT = 11.0 × 250 mV = 2.75 V
swing = 0 V + 50 mV to 3.3 V − 50 mV = 50.0 mV to 3.25 V
linear V_IN = 50.0 mV / 11.0 to 3.25 V / 11.0 = 4.55 mV to 295 mV
noise gain = 1 + R_F/R_G = 11.0
bandwidth = 1 MHz / 11.0 = 90.9 kHz
loop gain = 10^(100/20) / 11.0 = 9091 (79.2 dB)
real gain = 11.0 / (1 + 1/9091) = 10.99879 (−0.0110 %)The full-scale 250 mV comes out at 2.75 V. That uses 83 % of the ADC's range and leaves 500 mV before the output reaches the top of its swing, which happens at an input of 295 mV. At DC the open-loop gain costs about a hundredth of a per cent, far less than a 1 % resistor.
Using more of the range. A gain of 12 would put full scale at 3.0 V. In solve mode with RG = 4.7 kΩ, the exact RF is 51.7 kΩ. The nearest E24 value is 51 kΩ, which gives G = 11.851 (−1.24 %). The nearest E96 value is 52.3 kΩ, which gives 12.128 (+1.06 %). E96 barely helps here, because 51.7 kΩ falls almost exactly between 51.1 kΩ and 52.3 kΩ. Solve instead with RG = 10 kΩ, and a gain of 12 needs exactly 110 kΩ, which is in both series. The chart's search exists for this reason: the resistor you fix first decides how well the other one can land.
Clipping. Raise VIN to 300 mV and the stage asks for 3.30 V. That is inside the 3.3 V rail but above the 3.25 V the output can actually reach, so the output stops at 3.25 V and the calculator flags it. Switch the same resistors to the inverting stage and it is much worse: −10.0 × 250 mV is −2.50 V, the output has no negative rail to go to, and it sits at 50.0 mV. An inverting stage on a single supply needs a negative input, or its + input lifted to a reference voltage, before it can produce anything at all.
Where the ideal-op-amp gain stops being valid
SBOA092 claims the ideal gain equations are "directly applicable to real circuits - to within a few tenths of a percent in most cases", and backs it with an example. A ×10 inverting stage (10 kΩ and 100 kΩ) uses an op amp with an open-loop gain of 10,000, 50 kΩ of input impedance and 100 Ω of output impedance, driving a 10 kΩ load. Its error term comes to µ = 0.0013, and the real gain is −9.987, "accurate to within 0.13% of the idealized value". The calculator uses SLOA011's simpler form, which divides the ideal gain by 1 + 1/(AOL·β). Put ideal input and output impedances into the handbook's expression and it reduces to that form, −9.989 for the same stage. Most of the error is the open-loop gain; the rest is the op amp's finite input impedance (the ZO/Zinterm in µ) and, much less, its output impedance working against the load. The handbook calls this "a 'calibration' error" that "a slight adjustment of the feedback resistor" cancels.
The open-loop gain falls with frequency. With a constant gain-bandwidth product (SLOA011's GBW = AVD × f), the 1 MHz part in the example above has 100 dB at DC but only 40 dB at 10 kHz, and the error term 1/(AOL·β) grows as the gain falls. SBOA092's figure 34 shows the limit. "If the closed loop gain called for by the feedback configuration is greater than the open loop gain available from the operational amplifier for any particular frequency, closed loop gain will be limited to the open loop gain value." A ×100 inverting stage on an op amp with 1 MHz of open-loop bandwidth stays flat to about 10 kHz and then follows the open-loop line down. The calculator's bandwidth, GBW/(1 + RF/RG), is that corner: 1 MHz/101 = 9.90 kHz. It is a −3 dB point, where the gain is already 30 % low. For accuracy the loop needs gain to spare. SBOA092 asks for "open loop bandwidth of at least 200 MHz to provide a closed loop gain of 40 dB at 1 MHz", about twice what the corner arithmetic alone gives.
Noise gain, not signal gain, sets the bandwidth. This is where the inverting stage pays for its virtual ground. SBOA092 on the unity-gain inverter: "The bandwidth is decreased by one octave (50%) from that of the voltage follower due to the voltage division effect of the input and feedback resistors." Its signal gain is 1, but its noise gain is 2. At high gain the difference fades: for its ×1000 stages the handbook notes that the divider costs negligible bandwidth.
Large signals. The gain-bandwidth figure is a small-signal one. A full-swing output at high frequency meets the slew rate first. SLOA011 says of the maximum output-swing bandwidth that "the limiting factor for BOM is slew rate". Where the calculator's bandwidth looks comfortable but the output is volts wide, the datasheet's slew rate and maximum output-swing bandwidth are the numbers to check.
Output swing depends on the load. SLOA011: "Note that VOM± depends on the output load". A rail-to-rail output's headroom grows with the current it sources, because its output impedance "will limit how close to the rails the output can go". Use the VOH and VOL the datasheet specifies at a load like yours. The feedback pair is part of that load: RF + RG hangs across the output.
Input common-mode range. SBOA092: "For the inverting amplifier, one input terminal is grounded; hence, the common mode input voltage is zero. In the non-inverting configuration, however, an equal voltage appears at both input terminals and the common mode limit must be observed." A non-inverting stage whose input approaches a rail needs an op amp whose common-mode range includes that rail. SLOA011 lists which input structures reach which rail.
Stability at low noise gain. The follower, with a noise gain of 1, is the hardest case for the op amp's compensation. Some parts are compensated only for higher gains, and SBOA092 says such a part "cannot be used for lower gains without readjusting the compensation". A capacitive load erodes the margin further. That problem has its own calculator, linked below.
Common op amp gain mistakes
- Expecting a non-inverting stage to attenuate. Its gain is 1 + RF/RG, never less than 1. For a gain below 1, put a divider in front of a follower, or use an inverting stage with RF < RIN and accept the sign.
- Forgetting that the inverting stage's input impedance is RIN. A 1 kΩ RIN chosen to keep RF small at ×100 loads a high-impedance sensor into the ground. Where the source cannot drive RIN, use the non-inverting stage, whose input impedance SBOA092 puts at "hundreds or thousands of MΩ, closed loop", while adding for its example part that "current leakage paths associated with the input stage tend to limit the input impedance to be achieved in this manner to about 10 MΩ".
- Running an inverting stage from a single supply with a positive input. The output has to go negative and cannot, so it sits at the bottom of its swing. The fix is a reference on the + input, not a different op amp.
- Designing to the rails instead of the swing. Very few outputs reach the rail, and SBOA092's own ±15 V example saturates at ±13.5 V. Once saturated, "its behavior is unpredictable. Recovery time from saturation is not specified for op amps (except voltage limiting types)."
- Taking the bandwidth from the signal gain. A ×−1 inverter has half the bandwidth of a follower on the same op amp, because the op amp sees a noise gain of 2.
- Choosing resistor values from the ratio alone. SBOA092 puts the usual range at 1 kΩ to 1 MΩ. Below it, the pair loads the output. Above it, bias current through RF∥RG becomes an offset, and stray capacitance at the − input starts to shape the response. The DC error calculator puts a number on the first of those.
- Leaving rounding out of the error budget. Rounding RF to E24 can cost up to around 5 % of gain before tolerance is counted, and the miss is systematic. Take the actual gain the calculator reports, not the target.
Further reading
- TI SBOA092, Handbook of Operational Amplifier Applications (Carter and Brown). The summing point restraints, the follower, non-inverting and inverting derivations this page follows, the ideal-to-real comparison with its −9.987 example, and the Bode plots behind the bandwidth estimate.
- TI SLOA011, Understanding Operational Amplifier Specifications. The feedback factor, the finite-gain form of both stages, GBW = AVD × f, and what VOH, VOL and the common-mode range mean on a datasheet.
- TI SBOA626, Operational Amplifier Stability Theory and Compensation Methods. The feedback factor as a control loop, and noise gain as 1/β.
- Op-amp DC error budget calculator. Offset, drift and bias current through the same RF and RG, carried to the output at the noise gain.
- Op amp capacitive load calculator. What a capacitor on the output does to the phase margin at a given noise gain, and the isolation resistor that fixes it.
- Active filter calculator. The Sallen-Key and multiple-feedback stages, where the gain resistors also set the filter's Q.
- Voltage divider calculator. The divider the non-inverting stage feeds back through, and the attenuator that goes in front of a follower.
- E-series resistor calculator. The nearest stocked values, and pairs in series or parallel for a gain that no single E24 or E96 pair reaches.