To calculate op amp gain in standard closed-loop configurations, you use Av = -Rf / Rin for inverting amplifiers and Av = 1 + (Rf / Rin) for non-inverting amplifiers. These formulas assume an ideal operational amplifier operating within its linear region, meaning the output hasn't clipped against the supply rails. While the math is straightforward, applying it on the bench requires tracking your units, understanding your resistor ratios, and respecting the silicon limitations of the specific IC you've socketed.

The Core Gain Formulas and Symbol Definitions

Operational amplifiers rely on negative feedback to set a predictable closed-loop gain. Without feedback, an op-amp operates in open-loop mode, acting as a comparator with a gain equal to its internal open-loop gain (often >100,000). By adding a feedback resistor network, we force the output to a manageable, predictable level.

Symbol Definition Standard Units Notes
Av Voltage Gain (Closed-Loop) Unitless (V/V) Ratio of output voltage to input voltage. Often expressed in decibels (dB) in audio applications.
Vout Output Voltage Volts (V) The voltage present at the op-amp's output pin relative to circuit ground.
Vin Input Voltage Volts (V) The signal voltage applied to the input terminal (inverting or non-inverting).
Rf Feedback Resistor Ohms (Ω) Connects the output pin back to the inverting input pin to establish negative feedback.
Rin Input Resistor Ohms (Ω) Connects the input signal source to the inverting input pin (in inverting configs) or to ground (in non-inverting configs).

Inverting Amplifier Formula:
Av = Vout / Vin = - (Rf / Rin)

Non-Inverting Amplifier Formula:
Av = Vout / Vin = 1 + (Rf / Rin)

For a deeper dive into the internal transistor stages that make these feedback networks work, refer to the All About Circuits semiconductor textbook chapter on op-amp configurations.

Rearranged Forms: Solving for Resistors and Voltages

On the bench, you rarely know all variables. Usually, you have a target gain and a fixed input signal, and you need to calculate the exact resistor values to buy from your parts bin. Here are the algebraic rearrangements solving for each variable.

Inverting Configuration Rearrangements

  • Solve for Rf: Rf = -Av × Rin
  • Solve for Rin: Rin = -Rf / Av
  • Solve for Vout: Vout = Av × Vin (Note: Av will be a negative number here)
  • Solve for Vin: Vin = Vout / Av

Non-Inverting Configuration Rearrangements

  • Solve for Rf: Rf = (Av - 1) × Rin
  • Solve for Rin: Rin = Rf / (Av - 1)
  • Solve for Vout: Vout = Av × Vin
  • Solve for Vin: Vin = Vout / Av

Solved Problems: Tracking Units from Input to Output

The most common mistake hobbyists make is dropping unit prefixes during calculation. Let's track every unit explicitly through two bench scenarios.

Problem 1: Inverting Audio Preamp Stage

Given: You are building an inverting preamp for a dynamic microphone. The input signal is Vin = 50 mV. Your breadboard has an input resistor Rin = 10 kΩ and a feedback resistor Rf = 100 kΩ. Find Vout.

  1. Convert to base units: Vin = 0.050 V. Rin = 10,000 Ω. Rf = 100,000 Ω.
  2. Calculate Gain (Av):
    Av = - (Rf / Rin)
    Av = - (100,000 Ω / 10,000 Ω)
    Av = -10 V/V (The Ω units cancel out, leaving a unitless ratio).
  3. Calculate Vout:
    Vout = Av × Vin
    Vout = -10 × 0.050 V
    Vout = -0.5 V (or -500 mV).

Result: The output signal is inverted (phase-shifted 180°) and amplified to 500 mV peak.

Problem 2: Non-Inverting Sensor Buffer

Given: You need to buffer a 1.2 V DC temperature sensor signal and scale it to exactly 6.0 V for a legacy analog meter. You are using a non-inverting configuration and have a standard Rin = 4.7 kΩ resistor to ground. What value must Rf be?

  1. Determine Target Gain (Av):
    Av = Vout / Vin
    Av = 6.0 V / 1.2 V = 5 V/V.
  2. Rearrange formula for Rf:
    Rf = (Av - 1) × Rin
  3. Substitute and solve:
    Rf = (5 - 1) × 4.7 kΩ
    Rf = 4 × 4.7 kΩ
    Rf = 18.8 kΩ.

Result: Since 18.8 kΩ is not a standard E24 resistor value, you would use a 18 kΩ resistor in series with an 820 Ω resistor, or use a 20 kΩ trimmer potentiometer to dial in the exact 6.0 V output.

Real-World Bench Scenario: When Math Meets Silicon

Formulas assume an ideal op-amp. Silicon is not ideal. Here is a scenario that burns many beginners when they transition from simulation to the breadboard.

The Setup: You want to amplify a 0–50 mV thermocouple signal to a 0–3.3 V range to feed into an ESP32 ADC. You choose an LM358 dual op-amp because it's cheap and runs on a single 5V supply. You wire it as a non-inverting amplifier. Target gain is 66. You select Rin = 1 kΩ and Rf = 65 kΩ (using a 64.9k 1% resistor).

The Numbers:
At maximum temperature, Vin = 45 mV (0.045 V).
Expected Vout = 0.045 V × 66 = 2.97 V.
This is well within the 5V supply and the 3.3V ADC limit.

The Outcome:
You power it up. The multimeter reads 2.65 V at the output. Worse, when the thermocouple hits 48 mV, the output hard-clips at 3.1 V and won't go higher, ruining your linear scaling.

What Went Wrong:

  1. Output Swing Limitation: The LM358 is not a rail-to-rail output op-amp. On a 5V single supply, its datasheet specifies the maximum output high voltage (VOH) is typically VCC - 1.5V under light load, and worse under heavy load. It physically cannot reach 3.3V, let alone 5V.
  2. Input Offset Voltage (Vos): The LM358 has a typical Vos of 2 mV. Because this offset is inside the feedback loop, it gets amplified by your closed-loop gain of 66. That adds an unpredictable 132 mV of DC error to your output, shifting your baseline.
  3. The Fix: Swap the LM358 for a true rail-to-rail input/output (RRIO) op-amp like the MCP6001 or TLC27L2, and use a chopper-stabilized (zero-drift) op-amp like the AD8551 if you need to eliminate the offset voltage error entirely.

Assumptions, Unit Traps, and Realistic Magnitudes

To use these gain formulas reliably, you must understand the boundaries where the math breaks down.

When the Formula Applies (and Its Assumptions)

The closed-loop gain formulas apply only when the op-amp is operating in its linear region. This requires: 1. Negative feedback is present (Rf connects output to the inverting input). 2. The output is not saturated (Vout must remain between the negative and positive supply rails, accounting for the specific IC's headroom limits). 3. The signal frequency is within the bandwidth limit. Every op-amp has a Gain-Bandwidth Product (GBP). If an op-amp has a GBP of 1 MHz, and you calculate a closed-loop gain of 100 (40 dB), your maximum operating frequency before the gain drops by 3dB is only 10 kHz. For high-frequency signals, consult the manufacturer's op-amp bandwidth and slew rate specifications.

Which Unit Mistakes Break the Math

The ratio Rf / Rin is unitless, but only if both resistors share the same prefix. If Rf = 100 kΩ and Rin = 1 kΩ, the ratio is 100. If you accidentally grab a 100 Ω resistor instead of 100 kΩ, the ratio becomes 100 / 1000 = 0.1. Your gain collapses from 100 to 0.1, and your circuit acts as an attenuator. Always verify resistor values with a multimeter before soldering, especially when dealing with high-gain stages where Rf is significantly larger than Rin.

Another fatal unit trap is mixing Vin and Vout prefixes. If Vin is in millivolts and you expect Vout in volts, you must explicitly multiply by 10-3 during the Vout = Av × Vin step, or convert Vin to base Volts before calculating.

What a Realistic Answer Magnitude Looks Like

A realistic closed-loop gain magnitude for a single op-amp stage is between 1 and 100. If your formula spits out a required gain of 5,000, stop and redesign. Attempting a gain of 5,000 in a single stage will result in a bandwidth of just a few hundred Hertz, massive susceptibility to electromagnetic interference, and thermal noise that will drown out your actual signal. If you need a gain of 5,000, cascade two stages: a non-inverting stage with a gain of 50, followed by an inverting stage with a gain of -100. This preserves bandwidth, maintains stability, and keeps the math grounded in bench reality.