BJT Base Resistor Calculator

Calculate the base resistor that drives a BJT switch fully on (into saturation) from a microcontroller pin or logic output, from the drive voltage, VBE, load current, hFE and an overdrive factor.

Calculator Electronics Updated Oct 15, 2026
How to Use
  1. Enter the drive voltage from the pin or logic output (5 V, 3.3 V).
  2. Enter VBE, about 0.7 V for a silicon transistor in saturation.
  3. Enter the collector (load) current in mA and the transistor's minimum hFE at that current from the datasheet.
  4. Enter an overdrive factor of 5–10 so the transistor saturates even with a low-gain part.
  5. Read the base resistor and base current, round down to the nearest standard value, and check the pin can supply that current.
Input
V
V
mA
Presets
Circuit
Rb
—
Ib
—
Base P
—
Standard
—

Worked Example

A 5 V microcontroller pin switches a 100 mA relay coil through an NPN transistor whose minimum hFE is 100. Bare minimum base current = 100 mA ÷ 100 = 1 mA; with 5× overdrive, IB = 5 mA. RB = (5 − 0.7) ÷ 0.005 = 860 Ω, so use the next lower standard value, 820 Ω (5.2 mA, fine for the pin).

From a 3.3 V pin the same job needs (3.3 − 0.7) ÷ 0.005 = 520 Ω: 470 Ω from the E12 range, or 510 Ω from E24. Add a diode across the relay coil either way.

The common mistake: designing for exactly hFE. Using the typical gain (say 200) with no overdrive gives 8.6 kΩ and 0.5 mA of base current: a low-gain part from the same reel only half turns on, drops volts across itself and overheats.

Show Work

Enter values.

Formulas

Ib min
Ic / hFE
Linear.
Ib drive
k · Ic / hFE
For saturation.
Rb
(V−Vbe) / Ib
Series.
P resistor
(V−Vbe)·Ib
Dissipation.
Typical k
5–10
Saturation factor.
hFE variance
Wide (50–300)
Use min spec.

History of the BJT as a Switch

The transistor was invented at Bell Labs in late 1947, when John Bardeen and Walter Brattain demonstrated the point-contact device and William Shockley followed with the junction transistor — the device that earned them the 1956 Nobel Prize and launched the semiconductor revolution. The first BJTs were point-contact germanium devices; Shockley's 1949 junction transistor design (silicon by 1954) became the dominant form and the basis for the 2N2222 (1962), arguably the most-used discrete BJT in history.

Running a BJT as a saturated switch became routine in the transistor computers and control equipment of the late 1950s and 1960s, and the low-side switch (base resistor, NPN transistor, emitter to ground) became the standard way to let logic drive relays, lamps and solenoids. The overdrive factor (5–10×) covers the drop in hFE at high current and pulls VCE(sat) down to around 0.2 V, keeping the transistor cool.

Modern MCU-controlled load switching has largely moved to MOSFETs (logic-level N-channel for low-side, P-channel for high-side) because they have near-zero gate current and lower on-resistance per dollar. But BJTs remain preferred for small-signal switching, analog isolation (optocouplers, current mirrors), and low-cost driver stages where their 0.7 V base-emitter drop is a feature rather than a bug.

About This Calculator

Enter drive voltage (typically the MCU logic level), Vbe (~0.7 V for silicon, ~0.3 V for germanium), collector current Ic, minimum hFE (use the datasheet worst-case, not typical), and overdrive factor k (5-10 for saturation). The tool returns required base resistance Rb = (V_drive − Vbe)·hFE / (k·Ic), base current Ib, resistor dissipation, and the nearest standard E12 value.

When switching inductive loads (relays, solenoids, motors), add a flyback diode across the load — without it, the collapsing magnetic field will spike the collector voltage beyond VCEO and destroy the transistor. For loads above ~1 A, consider a MOSFET instead; below 100 mA, BJT remains the cheaper and simpler choice. Everything runs client-side; no values leave your browser.

Frequently Asked Questions

Why overdrive the base?

hFE varies between parts and falls at high current, and a transistor that is only just turned on sits partly on with several volts across it and gets hot. Driving 5–10 times the base current hFE suggests forces it hard into saturation, with VCE(sat) around 0.1–0.3 V.

Which hFE should I use?

The minimum hFE at your collector current from the datasheet, not the typical figure. Many small transistors have much lower gain at hundreds of milliamps than at 1 mA.

Can the microcontroller pin supply the base current?

Check its rating: many pins are comfortable at up to about 10–20 mA. If the base current needed is larger, use a Darlington pair, a second transistor, or a logic-level MOSFET, which needs almost no steady gate current.

Do I need a diode with a relay?

Yes. A relay coil is an inductor, and switching it off produces a large voltage spike that can destroy the transistor. A diode across the coil (cathode to the positive supply) gives the current a safe path.

Is it the same for PNP?

The same math applies, but a PNP high-side switch is turned on by pulling its base below the emitter. If the emitter sits at a higher voltage than the logic supply, the logic output cannot turn it off fully, so a small NPN is usually used to drive it.

How do I use the BJT Base Resistor Calculator?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Relay Driver

An NPN transistor with a base resistor and a flyback diode lets a 3.3 V or 5 V microcontroller switch a 12 V relay coil.

LED Strip and Lamp Switching

Low-side switching of a small LED strip or lamp from a logic pin, as long as the current suits the transistor (larger loads suit a MOSFET).

Buzzer and Small Motor Drivers

A transistor saves the microcontroller pin from the load current; add a diode for anything inductive.

Level Shifting

A transistor switch lets a 3.3 V signal pull a 5 V or 12 V line low.

Last updated: