Define which input is subtracted
The calculator calls the first signal V1 and the second V2. For the matched four-resistor arrangement it models, the result is Vout = (Rf/Rin) × (V2 − V1). This order fixes the sign: when V2 is greater, the ideal output is positive; when V1 is greater, it is negative. Write down the order beside measurements so a wiring or labeling swap is not mistaken for a gain error.
A difference amplifier is more than a subtractor in software. The physical circuit uses resistor networks around an op amp, and the two ratios must match for equal common-mode voltage to cancel ideally. The calculator represents the matched-ratio case with one input resistance and one feedback resistance. It does not accept four independent resistor values, so it cannot quantify ratio mismatch or predict a real circuit’s common-mode rejection.
Derive the ratio form
With matched branch ratios, the amplifier applies the same gain magnitude to the differential input V2 − V1. Define G = Rf/Rin; then Vout = G(V2 − V1). If the two resistances are entered in kΩ, their ratio has no unit and the output remains in volts. A ratio of five means each volt of difference maps to five ideal output volts, with sign set by the input order.
A common-mode voltage is the part shared by both inputs. If V1 and V2 each rise by the same amount, their difference is unchanged, so the ideal equation predicts the same output. That cancellation is conditional: source impedances, resistor-ratio mismatch, op amp input range, offset, and finite common-mode rejection create residuals in hardware.
Calculate two signed input differences
First subtract V1 from V2, then multiply by the resistor ratio. Do not take an absolute value unless the application specifically needs only the magnitude; the sign indicates which input is higher under the calculator’s convention.
Worked examples
Second input higher than first
Inputs: V1 = 1.1 V, V2 = 1.4 V, Rin = 10 kΩ, Rf = 50 kΩ.
Calculation: G = 50/10 = 5. V2 − V1 = 0.3 V. Vout = 5 × 0.3 = +1.5 V.
The positive result follows from the stated convention because the second input exceeds the first by 0.3 V.
Reverse the input difference
Inputs: V1 = 0.20 V, V2 = 0.10 V, Rin = 10 kΩ, Rf = 40 kΩ.
Calculation: G = 40/10 = 4. V2 − V1 = −0.10 V. Vout = 4 × −0.10 = −0.40 V.
Swapping which input is higher reverses the output sign while leaving the ideal gain magnitude unchanged.
Understand resistor matching as part of the signal path
The gain formula uses a ratio, not two isolated resistor values. In a real four-resistor network, matching the ratios on the two sides matters more for common-mode rejection than simply choosing four resistors with the same nominal tolerance. A common-mode input can be much larger than the wanted difference, so even a small mismatch may create an output comparable to the signal.
Use a matched network or measure and calculate the actual ratios when common-mode accuracy is important. Keep source impedances in view because they effectively add to input arms and can disturb the intended ratio. The calculator’s single Rin and Rf fields deliberately omit those details. It is not a component-selection or CMRR calculator.
Check common mode and output headroom separately
Suppose both inputs are near a supply rail while their difference is only a few millivolts. The differential equation may request a modest output, but the op amp’s input common-mode range can still be violated. Conversely, valid input pins do not guarantee enough output swing after multiplying a difference by a large gain. Check the actual device’s input and output limits with the intended supply, reference, and load.
A useful design order is to estimate the largest differential input, choose a gain that uses but does not exceed output range, then test the full common-mode range and resistor-ratio error. If the measured output shifts when both input voltages are raised together, investigate resistor matching, layout, source impedance, and the amplifier’s data-sheet CMRR. For the ideal sign and ratio calculation, use the matched resistor difference amplifier calculator.