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.
NPN switches the low side: the load hangs from the supply onto the collector, the emitter goes to ground, and the pin drives the base high. PNP is the mirror image for the high side: emitter on the supply, load from collector to ground, and the pin pulls the base low.
The supply the load runs from. For a PNP it is also the emitter voltage, so it is what the pin must pull the base down from, and back up to.
The pin's high level under load, V_OH, which the base resistor and the base-emitter junction share. 3.3 V from a modern microcontroller, 5 V from a classic one; the datasheet's V_OH at the current drawn is lower than the rail.
Enter the load as a resistance when it is one (a relay coil, a heater, a resistor), and I_C follows from the supply. Enter it as a current when something else sets it: an LED string with its own resistor, a motor at its stall current.
The collector current to switch. Use the worst case: a motor's stall current, a lamp's cold inrush, not the running value.
Collector-emitter saturation voltage, the datasheet maximum at your collector current. 55 mV for the PBSS4310PAS-Q at 1 A with 10 mA of base; 700 mV for a BC817 at 500 mA with 50 mA. It is only guaranteed at the I_C/I_B it was measured at.
Base-emitter saturation voltage, the datasheet maximum. Around 1 V at amps; a higher assumed value gives a smaller R_B and so more base current, which errs toward saturation.
The minimum DC current gain at your collector current, from the datasheet table, not the typical curve. It falls at high current and at low temperature: the BC817 is 100 minimum at 100 mA but only 40 at 500 mA.
Overdrive multiplies the base current a minimum-gain part needs, I_C/h_FE(min). Forced gain sets I_C/I_B directly, which is how datasheets state V_CE(sat): 10 for the BC817, 20 for Nexperia's resistor-equipped transistors.
How many times the bare minimum base current to supply. 1 saturates only a part at exactly h_FE(min), at 25 °C, with nothing to spare; the handbook sets no figure, so this is a design choice. Compare the forced gain it produces with the ratio the V_CE(sat) was specified at.
The series the resistor is taken from. The value fitted is the largest one at or below the exact result, so the base current never falls short of the target.
A resistor from base to emitter. It holds the transistor off while the pin floats and speeds turn-off, at the cost of V_BE/R_BE of the input current. 10 kΩ takes about 0.1 mA. Enter 0 for none.
The most current the driving pin may source (NPN) or sink (PNP) at the level you assumed, from its datasheet. Enter 0 to skip the check.
The I_C/I_B at which the datasheet states its V_CE(sat): 100 for the 55 mV PBSS4310PAS-Q figure, 10 for the BC817. The warning appears if this design drives the base more lightly than that. Enter 0 to skip.
The chosen part's total power rating on its footprint, from its datasheet: 250 mW for a BC817 in SOT23 on a standard footprint. Enter 0 to skip the check; the rating belongs to the datasheet's test board, not necessarily yours.
- 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)
- 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).
- 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).
- 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.
- 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
- The transistor is saturated. If the base current falls short of I_C/h_FE, V_CE rises out of saturation and the dissipation is far higher than the figure computed here; the calculator reports when the design drives less than a minimum-gain part needs.
- V_CE(sat) and V_BE(sat) are the datasheet maxima you enter. V_CE(sat) is only guaranteed at the I_C/I_B it was specified at, which the calculator checks when you give that ratio.
- The resistor fitted is the largest E24 or E96 value at or below the exact result, so rounding always adds base current. Resistor tolerance is not stacked on top.
- A PNP is driven by a pin that pulls its base to 0 V; the on-drive is the emitter supply. With the pin high, the base-emitter voltage left is V_CC − V_OH, divided by R_BE when fitted.
- Room-temperature datasheet values. At low temperature h_FE falls and V_BE rises, so more drive is needed; at high temperature the off-state margin shrinks.
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_C | I_C/I_B = 10 | I_C/I_B = 20 | ||||
|---|---|---|---|---|---|---|
| I_B | R_B, 3.3 V | R_B, 5 V | I_B | R_B, 3.3 V | R_B, 5 V | |
| 10.0 mA | 1.00 mA | 2.0 kΩ | 3.6 kΩ | 500 µA | 3.9 kΩ | 7.5 kΩ |
| 20.0 mA | 2.00 mA | 1.0 kΩ | 1.8 kΩ | 1.00 mA | 2.0 kΩ | 3.6 kΩ |
| 50.0 mA | 5.00 mA | 390 Ω | 750 Ω | 2.50 mA | 820 Ω | 1.5 kΩ |
| 100 mA | 10.0 mA | 200 Ω | 360 Ω | 5.00 mA | 390 Ω | 750 Ω |
| 200 mA | 20.0 mA | 100 Ω | 180 Ω | 10.0 mA | 200 Ω | 360 Ω |
| 500 mA | 50.0 mA | 39 Ω | 75 Ω | 25.0 mA | 82 Ω | 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 KThe 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
- Using the typical h_FE, or the top of the gain group. The design has to saturate the weakest part that can be fitted, which is h_FE(min) at the switched current, and it falls further when the board is cold.
- Rounding R_B to the nearest stocked value when that value is larger. A larger resistor delivers less than the base current the design asked for; the calculator always rounds down.
- Forgetting the base-emitter resistor's share. With a 1 kΩ R_BE and about 0.7 V across it, the handbook's arithmetic puts 700 µA into R2 before the transistor sees any; at small collector currents that can be most of the drive.
- Driving a PNP from a lower rail. A 3.3 V pin cannot turn off a PNP whose emitter sits at 5 V or 12 V; it needs a small NPN or an open-drain output to pull the base up to the emitter, and a pull-up from base to emitter to hold it there.
- Ignoring the pin's rating. The base current comes out of the microcontroller's output stage, whose V_OH also sags as the current rises. When the base current needed is more than a few milliamps, a logic-level MOSFET, sized with thegate resistor calculator, is usually the better switch.
- Letting the reverse base-emitter voltage exceed its rating. The handbook warns that "Most BJTs are specified so that VBE0 should not exceed a voltage from 5 V to 7 V depending on the chosen type"; the BC817's V_EBO is 5 V. A PNP driven from a pin whose high level is several volts above the emitter can reach it.
- Leaving the base floating. A microcontroller pin is usually high impedance through reset and bootloading, which leaves the base with nothing but leakage to decide its state. A base-emitter resistor, or apull-down sized for the pin, gives the off state a defined path.
Further reading
- Nexperia, BJT Bipolar Junction Transistor Application Handbook (V2, 2024) — the saturation region, the datasheet parameters of the PBSS4310PAS-Q explained line by line, resistor-equipped transistors and R2, switching times and the total-loss formula.
- Nexperia BC817 series datasheet — the h_FE groups at 100 mA and 500 mA, V_CE(sat) at I_C/I_B = 10, and the 250 mW SOT23 dissipation limit.
- LED resistor calculator — the same series-resistor arithmetic for the load a transistor switch most often drives.
- Relay coil suppression calculator — the diode or clamp a switched coil needs, and the release time it costs.
- Gate resistor calculator — the MOSFET alternative, where the gate draws charge at the edges rather than a steady base current.
- Pull-up and pull-down resistor calculator — sizing the resistor that holds an input in a defined state.
- E-series calculator — the stocked resistor values, and pairs of them for a value the series lacks.