NewAI Part GeneratorFree to get started
FREE TOOL

Transistor base resistor calculator

Use this transistor base resistor calculator to drive an NPN or PNP switch fully into saturation from a microcontroller pin or logic output. Enter the load current (or the supply and load), the drive voltage and the datasheet saturation voltages; it picks a standard resistor and reports base current, overdrive and power.

Load given as
Examples
Transistor
A
V
V

2N3904: 0.85 V max at 10 mA, 0.95 V max at 50 mA.

V

2N3904: 0.2 V max at 10 mA, 0.3 V max at 50 mA.

10 is the usual choice and the condition datasheets test saturation at.

Optional: the minimum DC gain from the datasheet.

A

Optional: continuous collector current rating.

A

Optional: the MCU or logic output current rating.

Resistor series

Base resistor

470 Ω

E24, rounded down

Exact value
470 Ω
Collector current IC
50 mA
Base current with the standard value
5 mA target 5 mA
Actual forced beta IC/IB
10
Voltage across the base resistor
2.35 V
Base resistor power
11.75 mW
Transistor dissipation
19.75 mW IC·VCE(sat) + IB·VBE(sat)
Current the drive pin sources
5 mA
Overdrive (hFE(min) ÷ forced beta)
6 ×

Assumes a low-side switch with the emitter at 0 V. Use VBE(sat) and VCE(sat) from the datasheet at a similar IC and IC/IB; the maximum VBE(sat) gives the safer (smaller) resistor.

E24 resistors near 470 Ω

ResistorBase currentForced betaStatus
360 Ω6.53 mA7.66Saturated
390 Ω6.03 mA8.30Saturated
430 Ω5.47 mA9.15Saturated
470 Ω5 mA10.0Saturated
510 Ω4.61 mA10.9Saturated
560 Ω4.2 mA11.9Saturated
620 Ω3.79 mA13.2Saturated

How do you choose the base resistor for a transistor switch?

Set the base current to a tenth of the collector current (a forced beta of 10), then RB = (Vdrive − VBE(sat)) ÷ IB and round down to a standard value. For a 2N3904 switching 50 mA from a 3.3 V GPIO: IB = 5 mA, RB = (3.3 − 0.95) ÷ 5 mA = 470 Ω. Check that the forced beta is well below the datasheet hFE(min) at that current.

Transistor base resistor formula

A saturated switch is driven with more base current than the load needs, so the collector current is set by the load and the transistor drops only VCE(sat). The base resistor sets that base current, and the transistor base current formula below starts from the forced beta you choose.

IB = IC ÷ βforced
IB
base current in A
IC
collector (load) current in A
βforced
chosen IC/IB ratio, typically 10

NPN low-side switch, emitter at 0 V, and PNP high-side switch, emitter at the supply:

NPN: RB = (Vdrive − VBE(sat)) ÷ IB     PNP: RB = (Vsupply − VEB(sat) − Vdrive) ÷ IB
Vdrive
drive voltage that turns the transistor on (GPIO high for NPN, low for PNP)
VBE(sat)
base-emitter voltage in saturation, from the datasheet
Vsupply
emitter voltage of the PNP

When the load is a resistance from a supply, the collector current and transistor dissipation are:

IC = (VCC − VCE(sat) − Vdrop) ÷ Rload     P = IC × VCE(sat) + IB × VBE(sat)

How to calculate base resistor values: worked examples

The steps are the same for any part: a 2N3904 base resistor from a 3.3 V GPIO, a BC547 base resistor from a 5 V Arduino pin, and a PNP high-side switch.

Example 1: 2N3904 switching 50 mA from a 3.3 V GPIO

The datasheet gives VBE(sat) 0.95 V and VCE(sat) 0.30 V (maximum) at IC = 50 mA, IB = 5 mA. With βforced = 10, IB = 5 mA and RB = (3.3 − 0.95) ÷ 5 mA = 470 Ω, already an E24 value (470 Ω). The transistor dissipates 19.7 mW. hFE(min) is 60 at 50 mA, so the overdrive is 6×.

Example 2: BC547 LED driver from a 5 V Arduino pin

A 2 V LED with 220 Ω from 5 V, and VCE(sat) 0.25 V, gives IC = (5 − 0.25 − 2) ÷ 220 = 12.5 mA. The BC547 datasheet tests saturation at IC/IB = 20, so with βforced = 20 the exact resistor is 6.88 kΩ (VBE(sat) 0.7 V typical); the E24 value below it is 6.8 kΩ, giving IB = 632 µA.

Example 3: a PNP high-side switch that never turns off

A 2N3906 switching 50 mA on a 5 V rail, driven low (0 V) to turn on: RB = (5 − 0.95 − 0) ÷ 5 mA = 810 Ω, so 750 Ω from E24. But a 3.3 V microcontroller can only pull the base up to 3.3 V, 1.7 V below the emitter, which keeps the transistor on. Drive the PNP base through an NPN (or N-channel MOSFET) and add a base-emitter resistor so it turns off when the NPN releases it.

Base resistor table for common currents and drive voltages

E24 values rounded down for a forced beta of 10 and VBE(sat) = 0.85 V (2N3904 maximum at 10 mA). At 100 mA and above VBE(sat) is higher, which calls for a slightly smaller resistor.

IC3.3 V drive5 V drive12 V driveIB
5 mA4.7 kΩ8.2 kΩ22 kΩ500 µA
10 mA2.4 kΩ3.9 kΩ11 kΩ1 mA
20 mA1.2 kΩ2 kΩ5.1 kΩ2 mA
50 mA470 Ω820 Ω2.2 kΩ5 mA
100 mA240 Ω390 Ω1.1 kΩ10 mA
200 mA120 Ω200 Ω510 Ω20 mA

Saturation data for common small-signal transistors

Datasheet saturation test points (maximum VCE(sat); VBE(sat) maximum except the BC547, which publishes a typical value), and the base resistor each needs at that point from 3.3 V and 5 V.

PartIC maxTest pointVCE(sat)VBE(sat)hFE(min)RB at 3.3 VRB at 5 V
2N3904 / MMBT3904 (NPN)200 mA50 mA / 5 mA0.3 V0.95 V60 min at 50 mA470 Ω810 Ω
BC547 (NPN)100 mA10 mA / 500 µA0.25 V0.7 V typ110 min at 2 mA (group A)5.2 kΩ8.6 kΩ
2N2222A / MMBT2222A (NPN)600 mA150 mA / 15 mA0.3 V1.2 V35 min at 150 mA, VCE 1 V140 Ω253 Ω
2N3906 / MMBT3906 (PNP)200 mA50 mA / 5 mA0.4 V0.95 V60 min at 50 mA470 Ω810 Ω

What goes wrong in real circuits

Use hFE(min) at your collector current, not the headline figure: the 2N3904 is guaranteed 100 at 10 mA but only 30 at 100 mA, and gain drops further in the cold. Check the drive pin can supply the base current (and sink it, for a PNP); a microcontroller output also sags below its supply when loaded, so use its VOH at that current. Inductive loads (relays, solenoids, motors) need a flyback diode across them, or the turn-off spike can exceed VCEO. Heavy overdrive stores charge in the base, which delays turn-off by up to a few hundred nanoseconds in small-signal parts (the 2N3904 storage time is 200 ns maximum at IB = 1 mA); when edge timing matters, add a base-emitter resistor or use a MOSFET. Above a few hundred milliamps, or when the pin cannot supply IC ÷ 10, a logic-level MOSFET is usually the better switch.

Glossary

Saturation
The fully-on state of a BJT, where both junctions are forward biased and VCE falls to a few hundred millivolts.
Forced beta (βforced)
The ratio IC/IB you choose for a saturated switch, well below hFE(min); 10 is the common choice.
hFE
DC current gain IC/IB in the active region. Datasheets give a minimum at stated IC and VCE.
VCE(sat)
Collector-emitter voltage of a saturated transistor at a stated IC and IB.
VBE(sat)
Base-emitter voltage of a saturated transistor at a stated IC and IB, higher than the 0.6 to 0.7 V of a lightly driven junction.
Low-side switch
A switch between the load and ground; an NPN with its emitter at 0 V.
High-side switch
A switch between the supply and the load; a PNP with its emitter at the supply.
Storage time
The delay before a saturated BJT starts to turn off while excess base charge is removed; it grows with overdrive.

Related guides

Frequently asked questions

How do you calculate the base resistor for a transistor switch?

Divide the collector current by a forced beta (usually 10) to get the base current, then RB = (Vdrive − VBE(sat)) ÷ IB. A 2N3904 switching 50 mA from a 3.3 V pin needs IB = 5 mA and RB = (3.3 − 0.95) ÷ 5 mA = 470 Ω.

Why use a forced beta of 10 instead of the transistor’s hFE?

hFE is the gain in the active region and varies several-fold between parts, with current and with temperature. A saturated switch needs more base current than IC ÷ hFE(min), and datasheets specify VCE(sat) and VBE(sat) at IC/IB = 10 (20 for the BC547), so designing to that ratio is what makes the datasheet saturation voltages apply.

What base resistor do I need to drive a 12 V relay from a 3.3 V microcontroller?

A 400 Ω coil on 12 V draws (12 − 0.3) ÷ 400 = 29.2 mA. With a 2N3904 and forced beta 10, IB = 2.92 mA and RB = (3.3 − 0.95) ÷ IB = 803 Ω, so use 750 Ω. Put a diode across the coil to clamp the turn-off spike.

Can a 3.3 V GPIO switch a PNP transistor on a 5 V or 12 V rail?

Not directly. To turn a PNP off, its base has to rise to within a few hundred millivolts of the emitter. A 3.3 V high level leaves the base 1.7 V below a 5 V emitter, so the transistor stays on. Use an NPN or N-channel MOSFET to pull the PNP base down, with a resistor from base to emitter to turn it off.

What 2N2222 base resistor should I use?

With the 2N2222A datasheet limits (VBE(sat) 1.2 V at 150 mA with 15 mA of base current), RB is 140 Ω from a 3.3 V drive and 253 Ω from a 5 V drive. For a smaller load, divide your collector current by 10 and use the same formula, RB = (Vdrive − VBE(sat)) ÷ IB.

How do you calculate the base resistor for a PNP transistor?

RB = (Vsupply − VEB(sat) − Vdrive) ÷ IB, with the emitter at the supply. A 2N3906 switching 50 mA on a 5 V rail, driven low to 0 V, needs 810 Ω, so 750 Ω from E24. Set the transistor to PNP (high side) to use this as a PNP base resistor calculator.

What happens if the base resistor is too large?

The base current is too small to saturate the transistor, so it sits in the active region with several volts across it. The load gets less voltage and the transistor dissipates IC × VCE, which can be tens or hundreds of times the saturated figure.

Should I add a resistor from the base to the emitter?

It keeps the transistor off while the driving pin floats (during reset or before firmware configures it) and speeds up turn-off. It draws about VBE ÷ R from the drive, so add that to the base current when you size RB.

When should I use a MOSFET instead of a BJT?

When the base current a BJT needs is more than the drive pin can supply, or the load current is above a few hundred milliamps. A 2N3904 at its 200 mA rating needs 20 mA of base current at forced beta 10; a logic-level MOSFET needs almost no steady gate current.

More free PCB tools

See all free electronics tools →

Sources

Design the whole board, not one number

ProtoFlow is free AI PCB design software: describe a circuit and get a schematic with real parts, PCB layout with an autorouter, SPICE simulation and Gerber files. Native KiCad, Altium and EAGLE import and export. Free on macOS, Windows and Linux.

Get for Mac

Free to start. No card required.