Transistor as a Switch Calculator

Size the base resistor to drive an NPN transistor into full saturation for relays, LEDs, and motors.
From Load Current
From Supply & Load Resistance

Base Resistor for Saturation

IB(sat) = IC/β  •  IB = ODF × IC/β  •  RB = (Vdrive − VBE) / IB  •  Pon = VCE(sat) × IC
5V MCU → 100mA relay
3.3V → 20mA LED
5V → 500mA motor
V
mA
V
V
Enter values and press Calculate.

From Supply Voltage & Load Resistance

IC = (VCC − VCE(sat)) / Rload  then  RB = (Vdrive − VBE) / (ODF × IC/β)
12V, 120Ω load
5V, 50Ω load
V
V
V
V
Enter values and press Calculate.

Driving a Transistor into Saturation

To use a BJT as an on/off switch you must drive it hard into saturation, not just the active region. The minimum base current is IC/β, but because β varies and drops at high current, designers multiply by an overdrive factor (ODF) of 2–10 to guarantee a low, stable VCE(sat).

QuantityFormula
Minimum base currentIB(sat) = IC / β
Actual base driveIB = ODF × IC / β
Base resistorRB = (Vdrive − VBE) / IB
On-state dissipationPon = VCE(sat) × IC

Choose the nearest standard resistor at or below the calculated RB so the base gets at least the intended current. Always add a freewheeling diode across inductive loads (relays, motors).

Real-World Applications & Examples

Worked examples

1. 5 V MCU driving a 100 mA relay. β=100, ODF=3: IB=3×100 mA/100=3 mA; RB=(5−0.7)/3 mA≈1.4 kΩ (use 1.2 k). On-loss=0.2×0.1=20 mW.
2. 3.3 V driving a 20 mA LED. ODF=5: IB=1 mA; RB=(3.3−0.7)/1 mA=2.6 kΩ (use 2.2 k for margin).
3. 500 mA motor. β sags at high current, so use ODF=5 and VBE=0.9 V: IB=25 mA, RB=(5−0.9)/25 mA≈164Ω (use 150Ω). Consider a MOSFET or Darlington above ~0.5 A.
4. Why the overdrive factor? With ODF=1 the transistor is on the edge of saturation; if β is lower than nominal it drops out of saturation, VCE rises, and the transistor overheats. ODF=3–5 gives margin.
5. From load resistance. 12 V across a 120Ω load: IC=(12−0.2)/120≈98 mA, then size RB as in example 1.
6. Choosing the standard resistor. A calculated 1.43 kΩ is rounded down to 1.2 kΩ so the base gets slightly more current — never round up, which could under-drive the switch.

Frequently Asked Questions

What does it mean to use a transistor as a switch?

Instead of amplifying, the transistor is driven either fully off (cutoff, open switch) or fully on (saturation, closed switch) to turn a load on and off, like a relay controlled by a small signal.

Why do I need a base resistor?

It sets the base current. Without it the base-emitter junction looks like a forward diode and would draw destructive current from the driving pin.

What is the overdrive factor?

A multiplier (typically 2–10) applied to the minimum base current IC/β. It guarantees the transistor stays hard in saturation despite β variation and its drop at high current.

What β value should I use?

Use the datasheet minimum hFE at your collector current, not the typical value. β falls at high current, so designing for the minimum keeps the switch reliable.

Why round the base resistor down to the nearest standard value?

Rounding down gives slightly more base current, keeping the transistor firmly saturated. Rounding up could under-drive it and cause overheating.

What is VCE(sat) and why does it matter?

The collector-emitter voltage when fully on (~0.1–0.3 V for small BJTs). It sets the on-state power loss VCE(sat)×IC and how much the transistor heats.

Do I need a flyback diode?

Yes, for any inductive load (relay, motor, solenoid). A diode across the load absorbs the voltage spike when the transistor turns off, protecting it from damage.

When should I use a MOSFET instead of a BJT?

For higher currents (above ~0.5 A) or where you want almost no drive current, a logic-level MOSFET is usually better — it has very low on-resistance and is voltage-driven.

Can I drive the transistor straight from a microcontroller pin?

Through the base resistor, yes. The pin only needs to supply the base current (a few mA), while the transistor handles the larger load current.

Why is my transistor getting hot as a switch?

Usually it is not fully saturated (too little base current) so VCE is high, or the load current exceeds its rating. Increase the overdrive factor or pick a bigger device.

What about a Darlington pair?

A Darlington has very high β so it needs little base current, but its VCE(sat) is higher (~0.7–1 V), meaning more heat. Good for high-current, low-frequency switching.

Does this work for PNP transistors?

The same currents apply; only the polarity and the way you reference the base drive change (a PNP high-side switch is turned on by pulling the base below the emitter).

How do I switch an AC load?

A BJT switches DC. For AC, use a relay driven by the transistor, or a triac/solid-state relay designed for AC loads.

Related Calculators

BJT Biasing CalculatorLED Series ResistorMOSFET Power LossAll Calculators