Transistor Base Resistor Calculator (BJT Switch)

To use a bipolar transistor as a switch for a relay, LED strip or buzzer, you must drive enough base current to saturate it fully. This transistor base resistor calculator works out the resistor from the load current and gain — see the basics of transistors and BJT currents and voltages.

calculated
calculated
Type in any field to change it. Press × on a value to calculate that field instead.

How to use the transistor base resistor calculator

Enter the drive voltage, the transistor’s VBE, the load current, the minimum hFE from the datasheet and an overdrive factor. You get the base current and the base resistor value — round down to the nearest standard value.

Base resistor formula

IB = (IC ÷ hFE) × k  ·  RB = (Vin − VBE) ÷ IB

Example

Switching a 100 mA relay from a 5 V microcontroller pin with a BC547-class transistor (hFE ≥ 100), 5× overdrive:

  • IB = 100 ÷ 100 × 5 = 5 mA
  • RB = 4.3 ÷ 0.005 = 860 Ω → use 820 Ω

Common small-signal transistors

Transistor Type Max IC Typical hFE
BC547 NPN 100 mA 110–800
2N3904 NPN 200 mA 100–300
2N2222A NPN 600 mA 100–300
BC337 NPN 800 mA 100–630
BD139 NPN 1.5 A 40–250
TIP120 NPN Darlington 5 A ≥ 1,000

Practical tips

  • Check that the microcontroller pin can supply the base current (often 10–20 mA max).
  • Add a 10 kΩ resistor from base to emitter to keep the transistor off while the pin floats at power-up.
  • Saturation voltage VCE(sat) is typically 0.1–0.3 V; power dissipated ≈ IC × VCE(sat).

Frequently asked questions

How do I calculate a transistor base resistor?

Find the base current I_B = I_C ÷ hFE × overdrive, then R_B = (V_in − V_BE) ÷ I_B. For 100 mA with hFE 100, 5× overdrive and 5 V drive, R_B ≈ 860 Ω.

Why use an overdrive factor?

hFE varies widely between parts and with temperature. Driving 2–10 times the minimum base current guarantees saturation and a low V_CE.

Do I need a diode with a relay?

Yes. Put a flyback diode across the relay coil to absorb the voltage spike when the transistor turns off.

When should I use a MOSFET instead?

For loads above a few hundred milliamps, a logic-level MOSFET needs no continuous drive current and wastes less power.

Embed this calculator

Free to use on your website or blog. Copy this code: