Skip to content
MoneyDeck

Transistor Base Resistor Calculator

Size the base resistor to switch a BJT fully on from a GPIO pin

Updated · Free, no signup

V

5 V Arduino Uno, 3.3 V ESP32 / Raspberry Pi.

V
mA

Use the datasheet minimum at your current, e.g. 2N2222 ≈ 100, BC547 ≈ 110.

Multiplier on Ic/hFE to guarantee saturation (2–10 typical).

V

Base resistor (exact)

860 Ω

Base current required

5 mA

Standard resistor to use

820 Ω

Largest standard value at or below the exact value, so drive is never short.

Base current with standard resistor

5.244 mA

Forced beta (Ic ÷ Ib)

19.1

Base resistor power

22.55 mW

Transistor dissipation when on

23.67 mW

  • Fit a 820 Ω resistor: it supplies 5.24 mA of base current, a forced beta of 19.1 against a minimum hFE of 100.
  • Inductive loads (relays, motors, solenoids) need a flyback diode across the load.

About the Transistor Base Resistor Calculator

This transistor base resistor calculator sizes the resistor between a microcontroller pin (or any logic output) and the base of a bipolar transistor used as a switch. Enter the drive voltage, the load current the transistor must carry, the minimum current gain hFE from the datasheet and an overdrive factor, and it returns the base current needed, the exact base resistor, the nearest standard value that still guarantees saturation, and the resulting forced beta.

It is meant for the everyday job of driving relays, solenoids, buzzers, LED strings and small motors from an Arduino, ESP32 or Raspberry Pi. The overdrive factor makes sure the transistor saturates fully even with a low-gain part, a hot day or a load that draws more than expected — a factor of 2 to 10 above the bare minimum, or a forced beta of about 10–20, is the usual practice.

The calculation treats the transistor as a saturated switch, not a linear amplifier. Vbe(sat) is typically 0.7–0.9 V for small-signal parts and higher for power transistors at large currents; use the datasheet value at your collector current. For a PNP high-side switch, enter the voltage difference between the emitter and the drive-low level as the drive voltage.

With the default inputs, the base resistor (exact) is 860 Ω. Change any value above to recalculate instantly.

How to use the transistor base resistor calculator

  1. 1Enter the logic-high voltage of the pin driving the base.
  2. 2Enter the current the load draws when switched on.
  3. 3Enter the minimum hFE from the transistor datasheet and an overdrive factor.
  4. 4Check Vbe(sat) and Vce(sat) against the datasheet at your current.
  5. 5Fit the suggested standard resistor and confirm the pin can supply the base current.

Formula and method

I_B = (I_C ÷ hFE_min) × k · R_B = (V_in − V_BE) ÷ I_B · forced β = I_C ÷ I_B

To use a BJT as a switch the base must receive enough current to drive it into saturation, where the collector-emitter voltage drops to a few tenths of a volt. The bare minimum base current is the load current divided by the transistor’s minimum gain; multiplying by an overdrive factor k guarantees saturation across part-to-part variation and temperature.

The base resistor drops the drive voltage minus the base-emitter voltage, so R_B = (V_in − V_BE) ÷ I_B by Ohm’s law. The calculator then picks the largest standard E12 or E24 value that is not above the exact value, so the actual base current is at least the target, and reports the forced beta (Ic ÷ Ib) — values of about 10–20 indicate a hard, low-loss switch. Transistor dissipation in the on state is Ic × Vce(sat) plus Ib × Vbe.

I_C
Collector (load) current (A)
hFE_min
Minimum DC current gain from the datasheet
k
Overdrive factor (≥ 1)
I_B
Required base current (A)
V_in
Drive (logic high) voltage
V_BE
Base-emitter saturation voltage
R_B
Base resistor (Ω)

Worked examples

100 mA load from a 5 V Arduino pin, hFE 100

Minimum base current is 100 mA ÷ 100 = 1 mA; with 5× overdrive that is 5 mA. R_B = (5 − 0.7) ÷ 0.005 = 860 Ω, so the nearest E24 value below is 820 Ω, giving 5.24 mA and a forced beta of about 19 — comfortably saturated.

20 mA buzzer from a 3.3 V ESP32, hFE 200

I_B = 20 mA ÷ 200 × 5 = 0.5 mA. R_B = (3.3 − 0.7) ÷ 0.0005 = 5.2 kΩ, and the nearest E24 value below is 5.1 kΩ, supplying about 0.51 mA — a light load for the GPIO pin.

70 mA relay coil with forced beta 10 (E12)

Using a factor of 10 with hFE 100 gives a forced beta of 10: I_B = 70 ÷ 100 × 10 = 7 mA, so R_B = 4.3 ÷ 0.007 ≈ 614 Ω. The next E12 value down is 560 Ω, delivering 7.68 mA. Add a flyback diode across the relay coil.

Frequently asked questions

How do I calculate the base resistor for a transistor switch?+

Divide the load current by the minimum hFE and multiply by an overdrive factor (typically 2–10) to get the base current. Then R_B = (V_drive − 0.7 V) ÷ I_B. Choose the next lower standard value.

What happens if the base resistor is too large?+

The base current is too small to saturate the transistor, so it operates in its linear region with a large Vce. It then dissipates much more heat, may overheat, and the load gets less voltage than expected.

What is forced beta?+

Forced beta is the ratio Ic ÷ Ib you actually impose in a switching circuit. Keeping it well below the transistor’s natural hFE — often around 10 to 20 — drives the transistor hard into saturation with a low Vce(sat).

Can I connect a transistor base directly to a GPIO pin?+

No. The base-emitter junction behaves like a diode, so without a resistor it would draw excessive current from the pin and could damage both the microcontroller and the transistor. Always use a base resistor.

Should I use a BJT or a MOSFET?+

BJTs are cheap and simple for loads up to a few hundred milliamps. For higher currents a logic-level MOSFET is usually better because it needs no continuous gate current and has lower on-state losses.

Related tools