Difference Amplifier

Four-resistor difference stage

Enter both inputs and all four resistors; the calculator checks the matching condition and reports differential gain, common-mode gain and CMRR.

V
V

Difference output

How to Use This Calculator

The difference amplifier amplifies the voltage between two inputs while rejecting whatever voltage both inputs share. It is built from one op-amp and four resistors: V1 enters through R1 into the inverting input with Rf as feedback, and V2 enters through a R2–Rg divider into the non-inverting input. The general output is Vout = V2·[Rg/(Rg+R2)]·(1+Rf/R1) − V1·(Rf/R1). When the resistor ratios are matched — Rf/R1 = Rg/R2, which in practice means R2 = R1 and Rg = Rf — this collapses to the clean form Vout = (Rf/R1)·(V2 − V1) and common-mode signals cancel exactly. Enter both voltages and all four resistors; the calculator reports the differential gain, the residual common-mode gain, the resulting CMRR in dB, whether the matching condition holds, and the output voltage.

Input fields

FieldSymbolUnitWhat to enter
InputsV1, V2VThe two signals to compare. Only their difference matters when the stage is balanced.
Inverting-side resistorsR1, RfΩ / kΩ / MΩR1 sets the input impedance of channel 1; Rf/R1 is the target differential gain.
Non-inverting-side resistorsR2, RgΩ / kΩ / MΩThe divider feeding the + input. For perfect cancellation set R2 = R1 and Rg = Rf (mirror the inverting side).

Step by step

  1. Pick your target gain k and choose R1 (often 10–100 kΩ to keep input impedance reasonable). With R1 = 10 kΩ and Rf = 100 kΩ the gain is ×10.
  2. Set the divider to mirror the inverting side: R2 = R1 = 10 kΩ, Rg = Rf = 100 kΩ. The "balanced" row in the result confirms the condition and CMRR reads ∞ (ideal).
  3. Enter V1 and V2 — with 0.5 V and 1.5 V the output is 10 × (1.5 − 0.5) = 10 V.
  4. To see what mismatch does, change one resistor by a percent or two: the common-mode gain row will rise from 0 and CMRR will fall to a finite dB value — that number is how much of a shared (noise) voltage leaks through.

A useful mental model: V2's path first attenuates by Rg/(Rg+R2) and then amplifies by the non-inverting gain (1+Rf/R1); V1's path is a plain inverting gain −Rf/R1. The matching condition makes those two paths equal, so identical voltages on both inputs produce exactly zero output. Note the input impedances are unequal by nature of the topology: channel 1 sees R1, while channel 2 sees R2+Rg (which equals R1+Rf when matched) — if both sources must see the same impedance or much higher values, an instrumentation-style three-op-amp front end is the usual upgrade.

What It Means in a Real Circuit

The difference amplifier's real value shows up when both inputs carry large common voltages plus a small difference — exactly the situation with sensor bridges. A Wheatstone bridge (strain gauge, RTD, load cell) sits at some bias voltage and develops a millivolt-level difference as its condition changes; the difference stage multiplies that difference while ignoring the bias. Common-mode rejection is also what lets such circuits sit near mains-coupled noise: 50/60 Hz hum picked up equally on both leads appears as common-mode signal and is divided by the CMRR before reaching the output. That is why the matching condition is not a nicety but the whole design goal — with Rf/R1 = R2/Rg held to 0.1%, CMRR stays above roughly 60 dB; at 1% mismatch it falls to about 40 dB, and a 1 V hum on both inputs then contributes 10 mV of error instead of 0.1 mV.

Real parts deviate from the ideal in predictable ways. Resistor tolerance is the dominant term, and its effect depends on gain: with mismatch Δ between the two ratios, the common-mode gain is roughly k·Δ/(k+1), so CMRR ≈ 20·log10(k/Δ). Four independent 0.1% resistors (worst-case ratio error ≈ 0.4%) give about 54 dB at ×1 gain but about 88 dB at ×100 — the absolute common-mode leak stays roughly constant while the wanted signal grows. Use 0.1% films or a laser-trimmed resistor quad for precision work, and keep the four resistors at the same temperature so their drifts track together (matched TCR helps more than tight initial values when the operating range is wide). The op-amp's own offset voltage multiplies by the noise gain 1 + Rf/R1 — with k = 10 a 5 mV general-purpose part adds up to 55 mV of error, which can swamp a millivolt bridge signal; low-offset or auto-zero parts (see the Input Offset Voltage Error calculator) are the standard fix. Bandwidth follows the same noise gain through the GBW limit, and the inverting-side input impedance is just R1, so very low-impedance sources are fine while high-impedance ones load channel 1.

A concrete design: reading a ±50 mV differential sensor signal riding on a 2.5 V bias, with possible 100 mV of common-mode hum. Choose k = 100 with R1 = R2 = 10 kΩ and Rf = Rg = 1 MΩ (or the 10× lower values if input current matters): the wanted signal becomes ±5 V, a comfortable ADC range. With four 0.1% resistors the common-mode gain is about 0.004, so the 100 mV hum leaves roughly 0.4 mV at the output — negligible against 5 V (CMRR ≈ 88 dB). The noise gain is 101, so a part with 25 µV max offset contributes at most 2.5 mV of DC error — acceptable, or trimmed out. If the sensor's common-mode swing approaches the op-amp's input common-mode range (often not including the negative rail on older parts), that limit — not the gain math — becomes the binding constraint, and a part specified for rail-to-rail input is required.

Frequently Asked Questions

The stage still amplifies (V2−V1) with gain ≈ Rf/R1, but a residual common-mode gain appears: identical voltages on both inputs no longer cancel, and the CMRR row shows how much shared signal leaks through. In this calculator a 1% ratio mismatch at ×10 gain drops CMRR to roughly 40 dB — enough for many jobs, not enough for millivolt sensing.

Subtracting two voltages with passive resistors is easy but loads both sources and can't amplify. The op-amp version adds gain, high input impedance on the V2 side, and — when balanced — rejection of the common part of the two inputs. That rejection (not the subtraction) is what makes it useful for sensor and noise-coupling problems.

An instrumentation amplifier (three op-amps) gives very high and equal input impedance on both channels, sets gain with a single resistor, and holds CMRR to much better than 100 dB because the matching is internal. The one-op-amp difference stage is cheaper and simpler but has unequal input impedances and needs four well-matched external resistors.

CMRR = 20·log10(k/|ACM|), where k = Rf/R1 is the differential gain and ACM is the common-mode gain (set V1 = V2 = 1 V in your head — this calculator does it for you). When balanced, ACM = 0 and CMRR is infinite; every percent of ratio mismatch costs you about 40 dB of idealism per decade of gain.

Yes — the difference is amplified by k. Two inputs of 2.5 V and 2.6 V with k = 100 give a 10 V output. Just check the result against your supply rails, and remember the noise gain (1 + Rf/R1) also multiplies the op-amp's offset voltage.

← All Op-Amp calculators