Skip to main content

Setting Op-Amp Gain With Two Resistors: Inverting and Non-Inverting

Set op-amp gain with feedback resistors. Inverting and non-inverting gain formulas, a worked Rf=10k Rin=1k example, and how to pick real resistor values.

Published By Li Lei
#electronics #op-amp #analog-design #calculator

Setting Op-Amp Gain With Two Resistors: Inverting and Non-Inverting

The first op-amp circuit most people build does one job: it makes a small signal bigger. What surprises beginners is how little it takes to control exactly how much bigger. Two resistors set the gain. That's it. No trimming the chip, no special parts, no firmware. Pick the ratio of those two resistors and you've pinned the closed-loop gain to a number you can predict on paper.

The catch is that there are two common ways to wire the stage, and they use the same two resistors to mean slightly different things. Get the topology straight and the rest is arithmetic. Get it muddled and you'll spend an evening wondering why your amplifier attenuates instead of boosting, or why it inverts a signal you wanted upright.

Two Resistors, One Feedback Loop

Both the inverting and non-inverting configurations rely on negative feedback. A fraction of the output is fed back to the inverting input through the feedback resistor, usually labelled Rf. The input resistor, Rin, sets the other half of the divider. The op-amp does whatever it takes to keep its two inputs at the same voltage, and the resistor ratio decides how hard it has to push the output to make that true.

That single idea, "the chip drives the output until both inputs match," is enough to derive every gain formula below. You don't need the open-loop gain, the slew rate, or the datasheet. For setting gain, the resistor ratio is the whole story.

The Non-Inverting Gain Formula

In a non-inverting stage the signal goes straight into the non-inverting (+) input, and the Rf/Rin divider hangs off the inverting (−) input to ground. The closed-loop gain is:

non-inverting gain = 1 + Rf / Rin

The output stays in phase with the input, and the gain can never drop below 1. That floor is the "1 +" term: even if Rf were zero, the stage would still pass the signal through at unity. You buy current drive and a high input impedance, but you cannot ask a non-inverting stage to attenuate.

A handy consequence: equal resistors give a gain of exactly 2, not 1. I have watched more than one bench session stall because someone reached for matched resistors expecting a buffer and got a doubler instead.

The Inverting Gain Formula

Wire the signal through Rin into the inverting (−) input, hold the (+) input at ground, and the gain becomes:

inverting gain = -Rf / Rin

The minus sign is real, not a typo. The summing junction sits at a virtual ground, so current pushed in through Rin has to flow out through Rf, and that pulls the output the opposite way to the input. A rising input gives a falling output: a 180-degree phase flip. For amplitude and decibels you take the magnitude, so a gain of −10 and a gain of +10 are both 20 dB. The sign only tells you about phase.

Unlike the non-inverting stage, an inverting stage with Rf smaller than Rin attenuates. Rf = 1k with Rin = 10k gives −0.1, a tenth of the input with a flip. That's a feature when you need it and a trap when you swapped the two resistors by accident.

A Worked Example: Rf = 10k, Rin = 1k

Plug the same pair of resistors into both formulas and the difference jumps out.

  • Inverting: gain = −Rf / Rin = −10000 / 1000 = −10. Feed in 0.1 V and the output swings to −1 V.
  • Non-inverting: gain = 1 + Rf / Rin = 1 + 10 = 11. Feed in 0.1 V and the output reaches +1.1 V.

Same two resistors, gains of −10 and +11, and one of them flips the signal. In decibels both magnitudes land near 20 dB (20·log10(10) is exactly 20 dB; 20·log10(11) is about 20.8 dB), because the decibel figure tracks amplitude, not the plus-one or the sign.

I lean on the op-amp gain calculator for exactly this comparison. I'll type one Rf/Rin pair, read both topologies side by side in V/V and dB, then flip on the output-voltage field to check whether my input swing would clip the rail before I touch a breadboard. It has saved me from soldering a −47 gain stage onto a ±5 V supply more than once, where a 0.2 V input would have demanded a −9.4 V output the rails simply cannot deliver.

Picking Real Resistor Values

The formulas hand you a ratio, but the parts bin holds standard values. Three rules keep the choice sane:

  1. Set the ratio first, then snap to standard values. Decide you want a gain of 20 non-inverting, so Rf/Rin = 19. Rf = 19 kΩ with Rin = 1 kΩ comes straight from the E24 set and lands the gain exactly. If you want a gain of 5, remember the non-inverting ratio is gain − 1 = 4, not 5; that off-by-one is the most common mistake in the whole exercise.
  1. Keep Rin in a sensible band. Somewhere between 1 kΩ and 100 kΩ usually balances two competing errors: too low and the resistors waste current and load the previous stage; too high and the op-amp's input bias current and Johnson noise start to matter. Pick Rin in that band, then let Rf follow from the ratio.
  1. Mind the supply rails. The math gives an ideal output of gain × input. A real op-amp clips when that product exceeds the supply. An 11× stage on a 5 V rail saturates once the input passes roughly 0.45 V, so always sanity-check the largest input you expect against the rail before committing to a gain.

When you've chosen Rf and Rin, the colour bands on the physical parts are the last place a swap can sneak in. If you're reading values off the bands rather than off a reel label, the resistor color code calculator decodes the stripes so you confirm you actually grabbed 10 kΩ and not 100 kΩ before the stage goes live.

Putting It Together

Setting op-amp gain comes down to one decision and one ratio. Choose inverting if you need attenuation, a virtual-ground summing point, or a phase flip; choose non-inverting if you need a high input impedance and a gain of at least 1. Then write down the formula for your topology, solve for Rf/Rin, snap to standard values, and check the output against your rails.

Do that and the amplifier behaves the way the equation says it will, every time. The op-amp itself is almost an afterthought once the two resistors are right.


Made by Toolora · Updated 2026-06-13