100nF

Transistor base resistor calculator

The base resistor that drives a bipolar transistor into saturation as a switch, NPN on the low side or PNP on the high side: the collector current from the load, the base current a minimum-gain part needs with the overdrive you choose, the stocked resistor that delivers at least that, and what it costs the driving pin and the transistor. Worked from Nexperia's BJT application handbook and the datasheet parameters it explains.

V_CC 5.00 Vpin highV_drive 3.30 VR_B 220 ΩI_B 10.5 mAloadI_C 1.00 AV_CE(sat) 55.0 mVP 65.5 mWI_C/I_B 95.7
Fig 1 — NPN low-side switch: 3.30 V across R_B = 220 Ω and the base gives I_B = 10.5 mA for I_C = 1.00 A, a forced gain of 95.7 and 3.14× the base current a minimum-gain part needs; 65.5 mW in the transistor.
Collector current I_C
1.00 A
Base current wanted
10.0 mA · 3 × I_C / 300
Base resistor R_B, exact
230 Ω · (3.30 V − 1.00 V) / 10.0 mA
Base resistor R_B, E24 at or below
220 Ω
Base current I_B with 220 Ω
10.5 mA · I_C/I_B = 95.7 · 3.14× the minimum
Pin current, sourced
10.5 mA · within the 20.0 mA rating
Transistor dissipation
65.5 mW · 55.0 mW collector + 10.5 mW base
Resistor dissipation, R_B
24.0 mW

How this is calculated

Standard: Nexperia — BJT Bipolar Junction Transistor Application Handbook, Design Engineer's Guide (V2, 2024); Nexperia BC817 series datasheet (Rev. 8, 2022)

IC=VCC−VCE(sat)RLI_C = \frac{V_{CC} - V_{CE(sat)}}{R_L}
The load current with the transistor saturated, when the load is a resistance. The handbook places saturation where "VCE < VBE" (pp. 40–41), and asks that a load switch "should be kept in this region and a suitable base current should be applied" (pp. 110–111).
IB=k IChFE(min)orIB=ICβforcedI_B = k\,\frac{I_C}{h_{FE(min)}} \quad\text{or}\quad I_B = \frac{I_C}{\beta_{forced}}
The handbook sets no overdrive figure, so k, or the forced gain I_C/I_B, is an input. What it does fix is the condition behind V_CE(sat): datasheets state it at a given I_C/I_B, "With the stronger base drive at a factor of 20, VCEsat is smaller compared to the lower base current condition" (pp. 108–109), and for resistor-equipped transistors "VCEsat in the data sheets is always specified at an IC/IB ratio of 20" (pp. 74–75).
RB=Vdrive−VBE(sat)IB+VBE(sat)/RBER_B = \frac{V_{drive} - V_{BE(sat)}}{I_B + V_{BE(sat)}/R_{BE}}
The drive voltage less the base-emitter drop, over the input current. The base-emitter resistor is the handbook's R2: it "acts as a leakage path and reduces the part of the input current that is available for driving the transistor", I_B = I_In − V_BE(forward)/R2 (pp. 70–71). For a PNP, V_drive is the emitter supply, with the pin pulling the base to 0 V.
P=VCE(sat) IC+VBE(sat) IBP = V_{CE(sat)}\,I_C + V_{BE(sat)}\,I_B
The handbook's "Total losses for BJTs: P = (VCE × IC + VBE × IB)" (pp. 132–133). The junction temperature follows as T_j = R_th(j−a) × P + T_amb (pp. 102–103).

Assumptions

What sets a transistor switch's base resistor

A bipolar transistor used as a switch is meant to spend its life in one of two states: off, with no base current, or saturated, with the collector pulled to within a few tens or hundreds of millivolts of the emitter. Nexperia's BJT application handbook places the boundary precisely: "for VCE < VBE, the BJT is in the saturation region", where the collector-base junction is forward biased as well as the base-emitter one. It also says what a switch needs to stay there: "If a BJT is used as a load switch, it should be kept in this region and a suitable base current should be applied. Once the collector current starts to clip, the power dissipation of the transistor increases steeply if the current increases further."

The base resistor is how that suitable base current gets set. The handbook describes the plain resistor in front of the base as "the most basic configuration", noting that "In addition to biasing, this also limits the input current and protects the device." With the pin high, the drive voltage divides between the resistor and the base-emitter junction, so R_B is the drive voltage less V_BE(sat), divided by the base current, as the reference note above sets out. The handbook's simulation of a BC847B switch puts the same thing the other way round: the voltage lost across the base resistor "is equal to IB × RB". The whole problem is choosing I_B.

The collector current is fixed by the load, (V_CC − V_CE(sat))/R_L for a resistor or relay coil, or a current you know. The transistor's DC gain h_FE then says how little base current would do, and the datasheet's minimum h_FE is the number that matters, because the part on the reel is not the typical one. The handbook is plain about it: "During production, BJTs can exhibit a wide range of current gains." The BC817 datasheet shows how wide: at 100 mA the BC817-25 is specified at 160 to 400, a factor of 2.5 between parts that carry the same marking.

Designing for exactly I_C/h_FE(min) saturates only a worst-case part at room temperature with nothing to spare, so every design drives the base harder than that. There are two ways to state how much harder, and the calculator takes either. An overdrive factor k multiplies the minimum base current: I_B = k·I_C/h_FE(min). Aforced gain fixes the ratio directly: I_B = I_C/βforced. The handbook gives no overdrive figure to choose, so the tool does not invent one. What it does give is the reason the forced gain matters: V_CE(sat) on a datasheet is a maximum measured at a particular I_C/I_B, and the handbook's example datasheet states it at I_C/I_B of 100 and of 20, noting that "With the stronger base drive at a factor of 20, VCEsat is smaller compared to the lower base current condition." A design that runs at a lighter drive than the datasheet condition has no guaranteed V_CE(sat) at all, which is why the calculator asks for that ratio and warns when the design falls outside it.

V_BE(sat) is the other datasheet maximum in the formula. The handbook notes that "Very often designers like to know the maximum VBEsat for a load-switch application", and its example gives it at I_C/I_B = 10. Using the maximum is the conservative direction: a higher assumed V_BE(sat) makes R_B smaller, and a real part with a lower one draws a little more base current, not less.

A base-emitter resistor R_BE changes the arithmetic. The handbook treats it in its chapter on resistor-equipped transistors, where it is called R2, and describes what it does to the input current: R2 "acts as a leakage path and reduces the part of the input current that is available for driving the transistor", so I_B = I_In − V_BE/R2. The calculator therefore sizes R_B for I_B plus V_BE(sat)/R_BE. What R_BE buys in return is stated two ways: it "stabilizes the current gain of the internal transistor and thus keeps the operating point more stable", and it "speeds up the removal of the excess charges. A smaller resistor is more efficient and leads to faster turn-off. The drawback is a higher leakage current IEBO." It also gives a floating pin, one still in reset, a defined path that holds the base at the emitter.

A PNP is the same circuit mirrored for the high side: emitter on the supply, load from collector to ground, and the pin pulling the base down through R_B to turn it on. The drive voltage is then the emitter supply itself, V_CC − 0 V, and the off state is where the trouble lies: with the pin at its high level, V_CC − V_OH is left across R_B and the base-emitter junction. The calculator reports that voltage and flags it when it reaches the 0.55 V from which the handbook's BC847B simulation "starts to conduct".

Base resistor chart for common collector currents

The E24 base resistor, taken at or below the exact value, for a transistor forced to I_C/I_B = 10 and to 20, from a 3.3 V and a 5 V pin. Ten is the ratio the BC817 datasheet states its V_CE(sat) at; the handbook says that for Nexperia's resistor-equipped transistors "VCEsat in the data sheets is always specified at an IC/IB ratio of 20." V_BE(sat) is taken as 1.2 V throughout, the BC817's maximum V_BE at 500 mA, which overstates it at the smaller currents and so errs toward more base current. Computed by the calculator above.

I_CI_C/I_B = 10I_C/I_B = 20
I_BR_B, 3.3 VR_B, 5 VI_BR_B, 3.3 VR_B, 5 V
10.0 mA1.00 mA2.0 kΩ3.6 kΩ500 µA3.9 kΩ7.5 kΩ
20.0 mA2.00 mA1.0 kΩ1.8 kΩ1.00 mA2.0 kΩ3.6 kΩ
50.0 mA5.00 mA390 Ω750 Ω2.50 mA820 Ω1.5 kΩ
100 mA10.0 mA200 Ω360 Ω5.00 mA390 Ω750 Ω
200 mA20.0 mA100 Ω180 Ω10.0 mA200 Ω360 Ω
500 mA50.0 mA39 Ω75 Ω25.0 mA82 Ω150 Ω

Two things the table makes plain. The drive voltage matters more than it looks: at 3.3 V only 2.1 V is left for the resistor once 1.2 V of V_BE is taken, against 3.8 V at 5 V, so the same base current needs a resistor almost half the size. And the bottom rows are not microcontroller loads at all. Forcing 500 mA to a ratio of 10 means 50 mA of base current, a figure to hold against the pin's datasheet before anything else, and that is before the BC817's gain at that current is considered: its datasheet specifies h_FE of only 40 at 500 mA, for every gain group, so even the bare minimum is 12.5 mA. The pin current limit field exists for exactly this; above a few tens of milliamps the answer is a buffer stage or a MOSFET.

Worked example: switching 1 A with a PBSS4310PAS-Q from a 3.3 V pin

The calculator's defaults are the transistor the handbook uses to explain datasheet parameters, the PBSS4310PAS-Q, a 10 V, 3 A low-V_CE(sat) NPN in a 2 mm × 2 mm DFN package. Its characteristics table gives h_FE of at least 300 at 1 A, V_CE(sat) of at most 55 mV at I_C = 1 A with I_B = 10 mA, and V_BE(sat) of at most 1 V at 1 A with 100 mA of base. The load is 1 A from 5 V, the drive a 3.3 V pin, and the overdrive 3, chosen because three times I_C/h_FE(min) is exactly the 10 mA at which the 55 mV figure was measured.

I_B wanted   = 3 × 1 A / 300                     = 10.0 mA
R_B exact    = (3.3 − 1.0) / 10.0 mA             = 230 Ω
R_B fitted   = E24 at or below                   = 220 Ω
I_B actual   = 2.3 V / 220 Ω                     = 10.5 mA
I_C/I_B      = 1 A / 10.5 mA                     = 95.7   (V_CE(sat) stated at 100: covered)
overdrive    = 10.5 mA × 300 / 1 A               = 3.14
P transistor = 55 mV × 1 A + 1.0 V × 10.5 mA     = 65.5 mW
P in R_B     = 2.3² / 220 Ω                      = 24.0 mW
T_j rise     = 268 K/W × 65.5 mW                 = 17.5 K

The thermal resistance is the handbook's figure for this part on a standard footprint, and the temperature rise uses its formula T_j = R_th(j−a) × P + T_amb. A 1 A switch dissipating 65.5 mWis the case for a low-V_CE(sat) part: at the 700 mV the BC817 datasheet allows at 500 mA, half this current would already put 350 mW into a package rated for 250 mW.

Adding a 1 kΩ base-emitter resistor takes V_BE/R_BE = 1.00 mAfrom the input before any reaches the base. The exact resistor falls to209 Ω, E24 gives 200 Ω, and the pin now supplies 11.5 mA of which 10.5 mA is base current.

Flip the same design to a PNP on the high side and the drive becomes the 5 V emitter supply: R_B = (5 − 1.0)/10 mA = 400 Ω, fitted as 390 Ω, sinking 10.3 mA into the pin. But the 3.3 V pin cannot turn it off: at its high level1.70 V remains across the base-emitter junction, well past the point where a transistor conducts. The same PNP driven from a pin on the 5 V rail leaves 0.00 V and switches off cleanly.

Where the saturated-switch model stops being valid

h_FE is a function, not a number. The minimum gain on a datasheet is stated at one collector current and one collector-emitter voltage, usually 1 V or 2 V, well out of saturation. The BC817's minimum is 160 at 100 mA for the -25 group but 40 at 500 mA for all of them, and the handbook notes that the PBSS4310PAS-Q's gain "starts to decrease" before steadying above about 1 A. Take h_FE(min) at the current being switched, not at the headline condition.

Temperature moves everything. The handbook's datasheet chapter notes that "hFE increases with temperature" and, for the base drive, that "At low temperatures a bigger base drive voltage is required because of the negative thermal coefficient of the forward voltage drop of the base-emitter path and a decrease of hFE." The shift is roughly −2 mV/K, which the handbook quotes for the base-emitter forward curve and the BC817 datasheet for V_BE. For a switch it draws the consequence directly: "the input voltage needs to be small enough to allow turning off at high temperatures and high enough to safely turn on at low temperatures." The room-temperature datasheet values the calculator uses are the start of a worst-case check, not the end of one.

V_CE(sat) belongs to its test condition. The handbook stresses studying test conditions "if parts are being compared", and a V_CE(sat) figure applies only at the I_C and I_C/I_B it states. Driving more lightly than that gives a higher V_CE(sat) than the datasheet maximum, and the dissipation computed here understates the real one.

Switching speed. Saturation stores charge in the base, and the handbook is direct about the cost: "For BJTs, the turn-off time is much longer than the turn-on time." The PBSS4310PAS-Q table shows it: 16 ns delay and 55 ns rise at turn-on against 190 ns of storage time at turn-off, even with a reverse base current driving it out. The handbook names two remedies, "avoiding the device going into deep saturation (IC/IB of 5 to 10), and helping to remove the charge more quickly at turn-off", the second being R_BE. For a relay the storage time is irrelevant; for PWM at tens of kilohertz it can be the limit, and the calculator flags a forced gain of 10 or below.

Inductive loads. A relay coil or motor fights the turn-off with a voltage spike that the saturated model knows nothing about. The collector needs a clamp, sized with therelay coil suppression calculator.

Resistor-equipped transistors. A digital transistor with R1 and R2 built in follows the same equations, but the handbook gives its R1 a tolerance of ±30 % and the ratio R2/R1 ±10 % or ±20 %, and recommends choosing the resistor combination from the typical VI(on) and VI(off) curves against collector current rather than from a calculated value.

Common transistor base resistor mistakes

Further reading