---
title: "Calculate voltage gain and output for operational amplifier circuits in inverting, non-inverting, and differential configurations. For inverting: Av = -Rf/Ri with input impedance equal to Ri. For non-inverting: Av = 1 + Rf/Rg with very high input impedance. For differential: Av = Rf/Ri applied to (V1 - V2). Reports gain in linear and dB, output voltage when input is provided, input impedance, and phase inversion status. Ideal op-amp assumptions (infinite open-loop gain, zero input bias current). Chain from ohms_law for power budgeting or resistor_color_code for component selection."
method: POST
path: "/api/op_amp_gain"
tags: ["pcb"]
---

# Calculate voltage gain and output for operational amplifier circuits in inverting, non-inverting, and differential configurations. For inverting: Av = -Rf/Ri with input impedance equal to Ri. For non-inverting: Av = 1 + Rf/Rg with very high input impedance. For differential: Av = Rf/Ri applied to (V1 - V2). Reports gain in linear and dB, output voltage when input is provided, input impedance, and phase inversion status. Ideal op-amp assumptions (infinite open-loop gain, zero input bias current). Chain from ohms_law for power budgeting or resistor_color_code for component selection.

`POST /api/op_amp_gain`

## Request

- Base URL: `https://calc.engineer`
- URL: `https://calc.engineer/api/op_amp_gain`
- Auth: none declared

## Request body

- object
  - `topology` 'inverting' | 'non_inverting' | 'differential', required: Op-amp circuit topology. 'inverting' uses Rf/Ri feedback with input to inverting terminal. 'non_inverting' applies input to non-inverting terminal with Rf/Rg feedback. 'differential' amplifies the voltage difference between two inputs.
  - `rf_ohm` number, required: Feedback resistor Rf in ohms. Sets gain magnitude in all topologies.
  - `ri_ohm` number, required: Input/gain resistor in ohms. For inverting: input resistor Ri. For non-inverting: ground resistor Rg. For differential: input resistor on both channels.
  - `vin_v` number: Input voltage in volts (optional). When provided, computes actual output voltage. For differential topology, this is V1 (non-inverting input).
  - `vin2_v` number: Second input voltage in volts (differential topology only). This is V2 (inverting input).

## Response `200`

Computed result for op_amp_gain

- object
  - `result` object, required
    - `topology` string, required: Op-amp topology used.
    - `gain` number, required: Voltage gain (Av). Negative for inverting topology.
    - `gain_abs` number, required: Absolute value of voltage gain.
    - `gain_db` number, required: Gain in decibels: 20 * log10(|Av|).
    - `vout_v` number, nullable, required: Output voltage in volts (null if no input voltage provided).
    - `input_impedance_ohm` number, required: Input impedance in ohms. Inverting: Ri. Non-inverting: very high (returned as 1e12). Differential: Ri.
    - `rf_ohm` number, required: Feedback resistor value used in ohms.
    - `ri_ohm` number, required: Input/gain resistor value used in ohms.
    - `phase_inversion` boolean, required: True if the output is phase-inverted relative to the input.
  - `tool` string, required
  - `version` string, required
  - `computed_at` string, date-time, required
  - `chain` object, required
    - `feeds` unknown[]
      - unknown
    - `accepts_from` unknown[]
      - unknown

## Other responses

- `400`: Validation error or invalid JSON
- `404`: Tool not found

---

[API](https://skmtc.dev/calc/apis/calc-engineer-api.md) · [All operations](https://skmtc.dev/calc/apis/calc-engineer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/calc/apis/calc-engineer-api/revisions/8830480ec488?raw)
