Optocoupler (CTR) Calculator

Size the input LED resistor, apply the current transfer ratio, and make sure the output transistor saturates.
LED Resistor & Transfer
Output Saturation Design

Input LED Resistor & Output Current

RLED = (Vin − VF) / IF  •  IC(available) = CTR × IF
5V logic, PC817 (CTR 50%)
12V, CTR 100%
3.3V, 5mA drive
V
V
mA
%
Enter values and press Calculate.

Design for Output Saturation

IC(needed) = (VCC − VCE(sat)) / Rpull-up  •  IF(required) = margin × IC(needed) / CTR  •  RLED = (Vin − VF) / IF(required)
5V out, 10k pull-up, CTR 50%
12V out, 4.7k, CTR 100%
V
kΩ
V
%
V
V
Enter values and press Calculate.

How an Optocoupler Works

An optocoupler (opto-isolator) transfers a signal across an isolation barrier using light: an input LED shines onto an output phototransistor. The key spec is the Current Transfer Ratio (CTR) — the output collector current divided by the input LED current. A CTR of 50% means 10 mA into the LED produces up to 5 mA at the output.

QuantityFormula
LED resistorRLED = (Vin − VF)/IF
Available output currentIC = CTR × IF
Current to saturate outputIC(needed) = (VCC − VCE(sat))/Rpull-up
Required LED currentIF = margin × IC(needed)/CTR

CTR falls with age and temperature and varies widely between parts, so always design with a margin (2× or more) so the output still saturates over the product\'s life.

Real-World Applications & Examples

Worked examples

1. PC817 from 5 V logic. VF=1.2 V, IF=10 mA: RLED=(5−1.2)/10 mA=380Ω (use 330Ω). With CTR=50%, output can sink up to 5 mA.
2. Saturating a 10 k pull-up. 5 V output: IC(needed)=(5−0.3)/10 k=0.47 mA. With CTR=50% and 2× margin, IF=2×0.47/0.5=1.9 mA — easily driven.
3. Low CTR part. A worn coupler at CTR=20% needs 2.5× more LED current for the same output — why the margin matters.
4. 3.3 V drive. Vin=3.3 V, VF=1.2 V, IF=5 mA: RLED=(3.3−1.2)/5 mA=420Ω (use 390Ω).
5. Stronger pull-up for speed. A smaller pull-up (say 1 k) needs more output current, hence more LED current, but gives faster, cleaner edges — a speed/current trade-off.
6. LED power. At 10 mA and 1.2 V the input LED dissipates just 12 mW — the resistor drops the rest of the input voltage.

Frequently Asked Questions

What is an optocoupler?

A device that transfers an electrical signal between two isolated circuits using light — an internal LED drives a phototransistor, with no electrical connection between input and output.

What is CTR (Current Transfer Ratio)?

The ratio of output collector current to input LED current, usually a percentage. CTR=50% means 10 mA into the LED gives up to 5 mA out.

Why does CTR matter so much?

It determines how much LED current you need for a given output current. Designing without margin can fail as CTR drops with age and temperature.

Why does CTR degrade over time?

The LED's light output falls with age and heat, so the same LED current produces less output current. Plan for 20–50% CTR loss over the product life.

How do I size the input LED resistor?

RLED = (Vin − VF)/IF, using the LED forward voltage (~1.2 V) and your chosen forward current. Round down to the nearest standard value.

How do I make sure the output fully turns on?

The available output current (CTR×IF) must exceed the current needed to pull the output down through its load/pull-up. Use the saturation tab and a 2× margin.

What is a typical LED forward voltage?

About 1.2 V for the infrared LED in common couplers like the PC817 and 4N35, at a few milliamps. Check the datasheet at your current.

What pull-up resistor should I use on the output?

A larger pull-up needs less output (and LED) current but gives slower edges; a smaller one is faster but needs more drive. 4.7 k–10 k is common for logic-speed signals.

How fast can an optocoupler switch?

Standard phototransistor couplers handle a few kHz to tens of kHz. For fast data use high-speed logic-output or IC optocouplers rated in Mbps.

What isolation voltage do optocouplers provide?

Commonly 2.5–5 kV between input and output, letting them safely separate mains-side and low-voltage circuits. Check the datasheet for your safety requirement.

Can an optocoupler drive a load directly?

Only small loads — the output transistor handles a few tens of mA. For larger loads, use the opto output to drive a transistor, MOSFET, or relay.

What is the difference between an optocoupler and a relay?

Both isolate, but an optocoupler is solid-state, fast, and low-current; a relay handles high current and switches AC or DC but is slower and mechanical.

Do I need a resistor on the output side?

Usually a pull-up (or load) resistor sets the output logic level. The phototransistor pulls the node low when the LED is on and the pull-up returns it high when off.

Related Calculators

LED Series ResistorTransistor as a SwitchDiode CalculatorAll Calculators