Op-Amp Gain Calculator — Inverting & Non-Inverting

Calculate op-amp gain from resistor values or find Rf/R1 for a target gain. Covers inverting and non-inverting configurations with GBP limit check for LM358, TL072, OPA2134.

Input

G = 1 + Rf / R1
Rf = R1 × (G − 1)

Result

Gain

+9101.000×

79.2 dB

Rf (feedback)91.0 MΩ (E24)
R110.0 kΩ
Gain error (ideal vs E24 Rf)90910.00%
GBP limit exceeded. LM358 (1 MHz GBP) supports max gain of 100.0× at 10 kHz. Use a faster op-amp or reduce gain.
+Vin+R1GNDRf91.0 MΩ10.0 kΩVout

Common gain stages

ApplicationConfigGainRfR1/RinNotes
ADC input bufferNon-inv0 Ω (wire)Unity gain, high impedance
Sensor signal ×10Non-inv10×90 kΩ10 kΩUse 100 kΩ + 10 kΩ E24
ADC pre-amp ×100Non-inv100×990 kΩ10 kΩUse 1 MΩ E24
Inverting summing ampInverting−1×10 kΩ10 kΩSignal inversion
Current sense ×20Non-inv20×19 kΩ1 kΩUse 18 kΩ + 1 kΩ (E24)
Microphone pre-ampInverting−100×100 kΩ1 kΩLow noise: use NE5532

How it works

Non-inverting configuration

The output is in phase with the input. Gain is set by the R1/Rf voltage divider on the inverting input:

G = 1 + Rf / R1     (always ≥ 1)
Rf = R1 × (G − 1)

For unity gain (voltage follower / buffer), short Rf to 0 Ω and leave R1 open. The non-inverting input sees a high impedance — useful for buffering sensors.

Inverting configuration

The output is 180° out of phase with the input. Input impedance equals Rin:

G = −Rf / Rin       (negative = inverted)
Rf = Rin × |G|

The inverting input is a virtual ground (held at 0 V by feedback). Input current flows through Rin and is “absorbed” by Rf. This makes the input impedance well-defined and load-independent.

Gain-bandwidth product (GBP)

Every op-amp has a unity-gain bandwidth — the frequency at which open-loop gain drops to 1×. GBP is approximately constant:

GBP = G × f_signal

→ f_max = GBP / G
→ G_max = GBP / f_signal

An LM358 with 1 MHz GBP can only deliver 100× gain up to 10 kHz. Above that, the actual gain starts rolling off. For a 100× audio pre-amp targeting 20 kHz, you need GBP > 2 MHz — use an NE5532 (10 MHz GBP) or OPA2134 (8 MHz GBP).

Resistor values

Keep Rf between 1 kΩ and 1 MΩ:

  • Below 1 kΩ: output stage has to source significant current just to drive the feedback network, increasing dissipation
  • Above 1 MΩ: bias current errors and noise become significant; input bias current through Rf creates an offset voltage

For a precision op-amp with 10 nA bias current and 1 MΩ Rf, the input-referred offset is 10 nA × 1 MΩ = 10 mV — significant for a sensor reading millivolts.

Balancing input bias current

Add a resistor R_bal = Rf ∥ R1 in series with the non-inverting input. This makes both inputs see the same impedance, so bias current creates equal offsets that cancel in the differential pair.

R_bal = Rf × R1 / (Rf + R1)

For a LM358 (input bias ~45 nA), this can save several millivolts of systematic offset.

Common op-amp selection

Op-ampGBPVosIbSupplyNotes
LM3581 MHz2 mV45 nA3–32V singleCheap, general purpose
NE553210 MHz0.5 mV200 nA±5–±15VLow noise audio
TL0723 MHz3 mV65 pA±5–±18VJFET input, low Ib
MCP60021 MHz4.5 mV1 pA1.8–6VRail-to-rail, 3.3V
OPA21348 MHz0.5 mV5 pA±5–±18VHigh precision audio
INA1281 MHz25 µV5 nA±2.25–±18VInstrumentation amp

Common mistakes

Exceeding the GBP limit and not knowing it. The circuit appears to work on a bench at low signal levels, but gain collapses at higher frequencies. Always calculate f_max = GBP / G and verify you’re below it with 3× headroom.

Floating the non-inverting input. If the + input is connected to a high-impedance source (photodiode, high-value resistor), it picks up 50/60 Hz interference. Add a 100 kΩ pull-down to establish a DC bias point, or use a JFET-input op-amp with its own bias network.

Rail-to-rail confusion. “Rail-to-rail output” means the output swings to within a few millivolts of the supply rails — but the input may not. A rail-to-rail input op-amp (RRIO) can accept inputs at or beyond the rails; a standard op-amp input must stay within the common-mode input range, typically Vss+1.5V to Vdd−1.5V.

Choosing Rf too large for the bias current. At 10 MΩ Rf and 100 pA bias current (TL072), the offset is only 1 mV. At 10 MΩ and 45 nA (LM358), offset is 450 mV — saturating the output. Match your resistor range to the op-amp’s bias current specification.

Frequently asked questions

Why does my op-amp circuit have correct gain at low frequencies but the gain drops at higher frequencies? +

You're hitting the gain-bandwidth product (GBP) limit. Every op-amp has a unity-gain bandwidth, and the product of closed-loop gain and signal frequency must stay below GBP. For an LM358 (1 MHz GBP) at 100× gain, the usable bandwidth is only 10 kHz. Above that, the actual gain rolls off. Calculate f_max = GBP / G and verify you have at least 3× headroom above your signal frequency.

Why is there a systematic DC offset error in my op-amp circuit? +

Input bias current flowing through the feedback resistors creates an offset voltage. For an LM358 with 45 nA bias current and 1 MΩ feedback resistor, the offset is 45 nA × 1 MΩ = 45 mV — enough to saturate a millivolt-level sensor signal. Fix: add a balance resistor R_bal = Rf ∥ R1 in series with the non-inverting input. This makes both inputs see the same impedance so the bias current offset cancels. Also consider switching to a JFET-input op-amp with picoamp-level bias current.

What does rail-to-rail mean on an op-amp datasheet? +

Rail-to-rail refers to two separate specifications. Rail-to-rail output means the output can swing to within a few millivolts of either supply rail, instead of stopping 1–2 V short. Rail-to-rail input (RRIO) means the common-mode input range extends to or beyond the supply rails — useful when the input signal swings to GND or VCC. These are independent features; an op-amp can have rail-to-rail output but a limited input range. Always check both specifications in the datasheet.

Newsletter

The embedded engineer's weekly cheat sheet

Register tricks, timing gotchas, and tool updates. One email per week. No fluff.

No spam. Unsubscribe anytime.