Op-Amp Basics: The Little Amplifier That Runs Half of Electronics

The operational amplifier, or op-amp, is the most reused building block in analogue electronics. One small eight-pin chip, plus a few resistors, can amplify a sensor signal, compare two voltages, filter out noise, or integrate a waveform over time. Audio equipment, instrumentation, control loops and power supplies all lean on op-amps, and once you understand the handful of rules that govern them, a huge number of circuits suddenly become readable. This guide starts with what an op-amp is, then builds up the circuits you will actually meet: the inverting amplifier, the non-inverting amplifier, the voltage follower, the comparator, the summing amplifier and the integrator, with gain calculations you can work through yourself.

Everything here stays at low, safe voltages, the kind you meet on a bench supply or a battery-powered breadboard. The principles are the same ones used in industrial signal conditioning, but the practical work belongs on the bench, not on mains-powered equipment. If the fundamentals feel new, our electronics circuits basics guide covers Ohm's law and Kirchhoff's laws, which every calculation here depends on, and our transistors explained guide shows what is actually inside the amplifier stage. For switching and timing circuits built around a different classic chip, see 555 timer circuits, and for the power supplies that feed all of this, see switch-mode power supplies explained.

What an op-amp actually is

An op-amp is a differential amplifier: it has two inputs, labelled inverting (−) and non-inverting (+), and one output. It amplifies the difference between the two input voltages by an enormous factor, called the open-loop gain, typically hundreds of thousands or more. Used on its own, that gain is far too large to be useful: the tiniest input difference drives the output hard against one supply rail or the other. That is why real op-amp circuits almost always use feedback, a connection from the output back to an input through resistors or capacitors. Feedback trades away most of that huge raw gain in exchange for a precise, predictable gain set by the external components, which is a very good bargain.

The classic device most beginners meet first is the 741, and the modern workhorse for general purpose work is often the LM358 dual or the TL071/TL072 family, but the principles are identical across parts. What changes between parts are the details: supply voltage range, output swing, input offset, noise and speed. Always check the datasheet for the part in your hand rather than assuming one op-amp behaves exactly like another. A circuit that works with one device can misbehave with another if, for example, the replacement cannot swing its output close enough to the supply rail, or its inputs cannot accept voltages near ground.

The two golden rules of the ideal op-amp

Analysis of op-amp circuits rests on two simplifying rules that hold well whenever negative feedback is working properly. Rule one: no current flows into either input. Real op-amps draw a tiny input bias current, but it is small enough that, for most circuits, you can treat the inputs as drawing nothing. Rule two: the two inputs sit at the same voltage. Feedback drives the output to whatever value makes the inverting input match the non-inverting input, so in a working linear circuit the voltage difference between the inputs is effectively zero. This second rule is sometimes called the virtual short, and it is the key to every gain calculation in this guide.

Both rules break down when the op-amp saturates, meaning its output has hit a supply rail and cannot go further. At that point feedback can no longer enforce the virtual short, and the input voltages diverge. That is not a fault: it is exactly how a comparator works, as you will see below. But it is also the most common source of confusion when analysing a circuit, so the first question to ask of any op-amp circuit is always: is this running in its linear region, or is it saturated?

The inverting amplifier: gain set by two resistors

In the inverting amplifier, the input signal goes through a resistor, R1, to the inverting input, while a feedback resistor, Rf, connects the output back to the same input. The non-inverting input is tied to ground (0 V). By the virtual short rule, the inverting input also sits at 0 V, a point called the virtual ground. No current enters the op-amp input, so all the current through R1 must flow through Rf. Working through that gives the gain formula: gain = −Rf / R1. The minus sign means the output is inverted: a positive input produces a negative output of the same shape, scaled by the resistor ratio.

Worked example: with R1 = 10 kΩ and Rf = 100 kΩ, the gain is −10. A 0.5 V input gives −5 V out. A 1 V input would ask for −10 V, which is fine on ±15 V supplies but would clip on a single 5 V supply, since the output cannot go below ground. That example carries two lessons that apply to every op-amp design: gain is set by a resistor ratio, not by the chip, and the supply rails set a hard ceiling on what the output can do. Choosing resistor values in the kilohm to hundreds-of-kilohm range keeps currents small and noise manageable; values that are too low load the source and waste power, while values that are too high invite noise and make the circuit sensitive to the op-amp's small input currents.

The non-inverting amplifier and the voltage follower

In the non-inverting amplifier, the signal goes directly to the non-inverting input, and a resistor divider (R1 to ground, Rf as feedback) sets the gain from the output back to the inverting input. The virtual short rule puts the inverting input at the input voltage, and the divider maths gives gain = 1 + Rf / R1. This gain is always positive and always at least one, and the input sees the op-amp's very high input impedance, so the circuit barely loads whatever drives it. That high input impedance is the reason non-inverting stages are used as buffers and sensor front ends.

The special case where Rf is zero (a direct wire) and R1 is removed gives a gain of exactly one: the voltage follower, or buffer. Its output simply copies its input. That sounds useless until you need it: a sensor that cannot supply much current can drive a follower, and the follower then drives the load. A follower also isolates stages, so a later stage cannot drag down an earlier one. Whenever a signal needs to travel from a weak source to a demanding load without changing size, a voltage follower is the right tool.

The comparator: an op-amp run deliberately into saturation

Remove the feedback, and the op-amp's huge open-loop gain takes over. Any positive difference between the inputs drives the output to the positive rail, and any negative difference drives it to the negative rail. That is a comparator: a circuit that answers the question "is this voltage above or below that reference?" with a clean high or low output. Comparators are used for threshold detection, zero-crossing detection, battery monitors and thermostat-style on-off control.

Real comparator circuits usually add a little positive feedback, a resistor from the output back to the non-inverting input, to create hysteresis. Hysteresis means the switch-on threshold and the switch-off threshold are slightly different, so a slowly changing or noisy input near the threshold does not make the output chatter rapidly between high and low. Without hysteresis, a sensor signal hovering at the threshold can switch the output dozens of times a second, which is rarely what you want driving a relay or an alarm. Dedicated comparator chips exist and are often a better choice than an op-amp for this job, because they are designed to switch cleanly and quickly, but the principle is the same either way.

Summing, difference and integrator circuits

The inverting configuration extends naturally to several inputs: connect two or more signals through their own resistors to the same virtual-ground node, and the output becomes the weighted sum of the inputs, each scaled by its own resistor ratio. This summing amplifier is how audio mixers combine channels and how analogue computers once added signals together. The difference amplifier, built with four matched resistors, outputs the difference between two inputs while rejecting voltage common to both, which is exactly what you need when measuring a small signal sitting on top of a large common voltage, such as the output of a bridge sensor.

Replace the feedback resistor with a capacitor and you get an integrator: the output becomes the running total, over time, of the input voltage. A steady positive input makes the output ramp steadily negative, and the slope depends on the input size and the RC product. Integrators appear in waveform generators, control loops and charge measurement. Swap the resistor and capacitor positions and you get a differentiator, which outputs a signal proportional to the rate of change of the input, though in practice differentiators need extra components to tame their sensitivity to high-frequency noise. These two circuits show why op-amps matter beyond simple amplification: with reactive feedback, the same chip performs mathematical operations on signals.

Real-world limits: rails, slew rate and offset

The ideal rules are a starting point, not the whole story. First, the output cannot exceed the supply rails, and most op-amps stop a volt or two short unless they are specified as rail-to-rail. Design with headroom: if you need ±10 V out, ±12 V supplies are tight and ±15 V supplies are comfortable. Second, slew rate limits how fast the output voltage can change, measured in volts per microsecond. A slow op-amp fed a large, fast signal will distort it into a triangle-like shape, because the output simply cannot keep up. Third, input offset voltage, a small built-in mismatch between the inputs, appears as a small output error, multiplied by the gain, which matters in high-gain precision circuits and barely matters in a simple audio stage.

Single-supply operation deserves a special mention, because most beginner projects run from one battery or one USB supply rather than split ±15 V rails. With a single supply, the op-amp's ground reference is the negative rail, so signals must be biased to a mid-supply reference (often half the supply voltage) for the output to swing both ways around it. Coupling capacitors block that DC bias from reaching the next stage. It is a small complication, but it is the difference between a circuit that works on the bench and one that clips half its waveform the moment you power it from a single battery.

Common mistakes and how to avoid them

The most common beginner mistake is forgetting the power supply connections: an op-amp with no supply, or with supplies swapped, does nothing at all, and the symptom looks like a dead chip. Next is leaving an input floating, which picks up noise and makes the output wander or rail unpredictably. Then comes asking for more output than the rails allow, which shows up as flat-topped, clipped waveforms on an oscilloscope. And finally, using resistor values far outside the sensible range: megohm feedback resistors invite noise and offset errors, while very low values load the output and waste current. Check the supply, check the rails, check the feedback, and most "dead" op-amp circuits come back to life.

A good working method is to calculate first, then build, then measure. Work out the expected gain and the expected output swing, build the circuit on a breadboard, and check the output against your calculation with a multimeter or oscilloscope before trusting it. That loop, predict, build, verify, is the same discipline used in reading electrical schematics and simulation, and it catches wiring errors far faster than guessing. Once the basic stages are comfortable, you can combine them: a sensor into a follower, into a gain stage, into a filter, into a comparator is a complete instrument channel built from the blocks in this guide.

Frequently asked questions

What is an op-amp in simple terms?

An operational amplifier is a high-gain differential amplifier: it amplifies the voltage difference between its two inputs. With external resistors and capacitors you set what it actually does, turning the same chip into an amplifier, a comparator, a filter or an integrator.

Why does an inverting amplifier have a minus sign in its gain?

The minus sign means the output is inverted relative to the input: a positive input gives a negative output. It comes from the signal entering the inverting input, and it matters for phase but not for the size of the gain, which is the resistor ratio.

Can an op-amp output any voltage?

No. The output can only swing within the supply rails, and in practice it stops a little short of them unless the part is rail-to-rail. If your gain calculation asks for more than the supply allows, the output clips at the rail instead.

Next steps: see what is inside the amplifier stage in transistors explained, build switching and timing circuits in 555 timer circuits, and learn what powers all of this in switch-mode power supplies explained. For the circuit laws behind every calculation here, return to electronics circuits basics.