Transistor base resistor calculator
For an NPN switch, the base resistor is the control voltage minus 0.7 V, divided by the base current you need: Rb = (Vin − 0.7) ÷ Ib, with Ib = Ic ÷ hFE times an overdrive factor (about 5) so the transistor turns fully on.
Ib = (Ic ÷ hFE) × overdriveRb = (Vin − 0.7) ÷ Ib| Base current | 5 mA |
|---|---|
| Base resistor (exact) | 860 Ω |
| Standard value (E12, rounded down) | 820 Ω |
Worked example
A 100 mA load on 12 V, switched from a 5 V pin, with a transistor of hFE 100 and 5× overdrive: Ib = (0.1 ÷ 100) × 5 = 5 mA, Rb = (5 − 0.7) ÷ 0.005 = 860 Ω. Round down to 820 Ω. In the simulator the load gets 101 mA and only 0.08 V is left across the transistor: it is fully on.
Questions
Why multiply by an overdrive factor?
hFE varies a lot between parts and falls at high current. Driving the base about 5 times harder than the minimum makes sure the transistor saturates (switches fully on) and stays cool.
Which hFE should I use?
The minimum from the datasheet at your load current, not the typical value. For a 2N2222 or BC547 at 100 mA, 100 is a safe start.
Can a microcontroller pin drive the base?
Yes, if the base current is within the pin's limit (often 20 mA, check your board). For bigger loads use a logic-level MOSFET instead.
Do I need a diode?
For motors, relays and solenoids, yes: put a diode across the load (cathode to the positive supply) to absorb the voltage spike when the transistor switches off.
More calculators
- Resistor color code calculator
- LED resistor calculator
- Voltage divider calculator
- RC time constant calculator
- Ohm's law calculator
- Series and parallel resistor calculator
- 555 timer calculator (astable)
- PCB trace width calculator
- Battery life calculator
- RC filter calculator (low-pass)
- Capacitor code calculator
Want a whole circuit rather than one value? Describe it and the AI designs and simulates it.