100nF

LED current limiting resistor calculator

The resistor that sets an LED string's current, the standard value to fit, what it dissipates, and how far the current wanders once the supply, the LED and the resistor are all at the wrong end of their tolerances.

5 V150 Ω20.0 mA →1 × 2 V
Fig 1 — 1 LED at 2 V, 20.0 mA through 150 Ω.
Exact resistor
150 Ω
E24 value at or above
150 Ω
Current with 150 Ω
20.0 mA
Headroom across R
3.00 V
Resistor power
60.0 mW → any 0603 or larger
LED power / efficiency
40.0 mW · 40 %
Worst case, ±5 % supply, ±0.2 V Vf, ±1 % R
16.8 to 23.2 mA

How this is calculated

Standard: Ohm's law; LED datasheet Vf–If curve

R=Vs−n⋅VfIfR = \frac{V_s - n \cdot V_f}{I_f}
I(R)=Vs−n⋅VfRI(R) = \frac{V_s - n \cdot V_f}{R}
PR=I2R,PLED=I⋅nVf,η=PLEDPR+PLEDP_R = I^2 R, \quad P_{LED} = I \cdot n V_f, \quad \eta = \frac{P_{LED}}{P_R + P_{LED}}
η is the share of the power that reaches the LEDs rather than heating the resistor.
Imin=Vs(1−s)−n(Vf+ΔVf)R(1+r)I_{min} = \frac{V_s(1-s) - n(V_f + \Delta V_f)}{R(1+r)}
Worst case low, with supply tolerance s and resistor tolerance r.
Imax=Vs(1+s)−n(Vf−ΔVf)R(1−r)I_{max} = \frac{V_s(1+s) - n(V_f - \Delta V_f)}{R(1-r)}
Worst case high — this is the one that cooks the LED.

Assumptions

What sets an LED's series resistor

A resistor in series with one or more LEDs on a fixed supply. The LED drops roughly Vf regardless of current, so the rest of the supply sits across the resistor, and that sets the current. The resistor for a design current, the current you actually get once a stock value is fitted, and the power split between resistor and diodes are the first three expressions under How this is calculated above, with n the number of LEDs in series.

The quantity to watch is the headroom, Vs − n·Vf. With 3 V of headroom a 0.3 V shift in Vf moves the current 10 %; with 0.5 V it moves it 60 %. So the tool also stacks supply, Vf and resistor tolerances the wrong way and reports the current range you will see across a batch of boards.

Vf depends on the chemistry, not the package. Typical values at 20 mA:

ColourVf
Infrared1.2 to 1.6 V
Red, orange, yellow1.8 to 2.2 V
Green (GaP, yellowish)2.0 to 2.4 V
Green (InGaN, pure), blue, white2.8 to 3.4 V
UV3.2 to 3.8 V

Datasheets give Vf as min, typ and max at the test current, and vendors sell by Vf bin, so two reels of the same part number can differ by 0.4 V. Vf also drops about 2 mV/°C, so a warm LED pulls more current; not runaway with a resistor, but a visible drift when the headroom is small.

LED resistor chart

The series resistor for one LED on the common rails, computed by the calculator above and rounded up to the E24 value so the current comes out at or just under the target. Each cell is the part, the current it actually sets, and the power it dissipates, which is what decides the package. Forward voltages are typical; the calculator takes the number from the datasheet curve.

SupplyRed, Vf 2.0 V, 20 mARed, 2.0 V, 10 mAWhite or blue, Vf 3.2 V, 20 mAWhite or blue, 3.2 V, 10 mA
3.3 V68 Ω, 19.1 mA, 25 mW130 Ω, 10.0 mA, 13 mWno headroomno headroom
5 V150 Ω, 20.0 mA, 60 mW300 Ω, 10.0 mA, 30 mW91 Ω, 19.8 mA, 36 mW180 Ω, 10.0 mA, 18 mW
9 V360 Ω, 19.4 mA, 140 mW750 Ω, 9.3 mA, 65 mW300 Ω, 19.3 mA, 110 mW620 Ω, 9.4 mA, 54 mW
12 V510 Ω, 19.6 mA, 200 mW1 kΩ, 10.0 mA, 100 mW470 Ω, 18.7 mA, 160 mW910 Ω, 9.7 mA, 85 mW
24 V1.1 kΩ, 20.0 mA, 440 mW2.2 kΩ, 10.0 mA, 220 mW1.1 kΩ, 18.9 mA, 390 mW2.2 kΩ, 9.5 mA, 200 mW

The 24 V column is the one to look at twice: the resistor burns ten times the LED's own power, and a 0603 will not survive it. The 3.3 V white cell has no entry because a tenth of a volt of headroom is not a design; that LED wants a 5 V rail or a constant-current driver.

Worked example: a red indicator on a 5 V rail

A red indicator on a 5 V rail, Vf 2.0 V, 20 mA.

headroom = 5.0 − 1 × 2.0        = 3.0 V
R        = 3.0 / 0.020          = 150 Ω        E24 value, fit it as is
I        = 3.0 / 150            = 20.0 mA
P_R      = 0.020² × 150         = 60 mW        a 0603 (100 mW) is fine, 0402 (63 mW) is marginal
P_LED    = 0.020 × 2.0          = 40 mW
η        = 40 / (60 + 40)       = 40 %

Now the tolerances: a 5 % regulator, ±0.2 V of Vf spread from the bin, a 1 % resistor.

min:  Vs = 4.75 V, Vf = 2.2 V, R = 151.5 Ω
      I = (4.75 − 2.2) / 151.5 = 2.55 / 151.5 = 16.8 mA

max:  Vs = 5.25 V, Vf = 1.8 V, R = 148.5 Ω
      I = (5.25 − 1.8) / 148.5 = 3.45 / 148.5 = 23.2 mA

A 20 mA design lands between 16.8 and 23.2 mA, about ±16 %. Fine for an indicator. Put the same LED on 3.3 V and the headroom is 1.3 V: fit 68 Ω and the same tolerances give 13.6 to 24.7 mA, a 1.8:1 spread. The 1 % resistor is not the problem; 0.4 V of Vf spread against 1.3 V of headroom is.

Current limiting resistor: before or after, and for several LEDs

The resistor limits the current by dropping whatever the supply has left over once the LED has taken its forward voltage, and a series loop has the same current everywhere in it, so the resistor works identically on the anode side or the cathode side. Put it wherever the layout is shortest; the only difference is which node sits at the supply and which swings, which matters for noise on a long lead and for nothing else.

Several LEDs in series share one resistor and one current, and their forward voltages add: the calculator's series count does exactly that, and the headroom shrinks by one Vf per LED until the rail runs out. Several LEDs in parallel on one resistor do not share the current equally: the part with the lowest forward voltage takes most of it, brightens, heats, and its Vf falls further. A seven-segment display is the everyday case, seven or eight LEDs that light in every combination; one resistor per segment, each sized here for one LED, is the arrangement that keeps every segment at the same brightness whatever else is lit. A shared resistor on the common pin makes an "8" dimmer than a "1" by a factor of seven.

Where the constant-Vf model stops being valid

The model. An LED is a diode with an exponential I-V curve, not a fixed drop. Constant Vf is accurate near the datasheet test current and worse away from it: a red LED at 2 mA reads 1.7 V, a power white at 100 mA may be 3.6 V. Take Vf from the curve at your current.

Driving from a GPIO. A microcontroller pin has tens of ohms of output resistance and a rated drive, typically 4 to 20 mA per pin with a budget per port and per device (STM32: 8 mA typ, 25 mA abs max, 120 mA for the chip; AVR: 20 mA per pin, 200 mA total). At 20 mA the pin has sagged a few hundred millivolts, so the headroom and the current are less than the calculator says. Use 2 to 5 mA for indicators, or a transistor.

PWM. The resistor sets the peak current; the duty cycle sets the average. 20 mA peak at 25 % duty is 5 mA average and the resistor power scales the same way. Keep the peak under the pulsed rating and the frequency above a few hundred hertz.

Parallel LEDs on one resistor. The one with the lowest Vf takes the most current, gets hottest, drops further, takes more. Two identical LEDs can split 40 mA as 25 and 15, and if one fails open the other gets the lot. One resistor per LED.

12 V strings. Three white LEDs at 3.2 V leave 2.4 V of headroom, which is why LED strip runs three per segment. Four leave nothing. The tool refuses when n·Vf reaches the supply; treat under 1 V of headroom as a warning.

When to stop using a resistor. Above about 100 mA the resistor burns as much as the LED, and brightness matching across channels or temperature is at the mercy of Vf. A constant-current driver (a linear sink like the CAT4101, a buck like the AL8860) regulates current directly and, switching, runs above 90 %.

Common LED resistor mistakes

Further reading