LED Current Limiting Resistor Calculator

Calculate the series resistor value for any LED. Choose from Red, Green, Blue, White, UV, and IR LEDs. Shows E24 resistor value, actual current, power dissipation, and GPIO drive safety.

LED Type

Parameters

Supply Voltage (Vs)
Forward Voltage (Vf)1.82.2 V
LED Current (If)max 30 mA

A      K

ON

2V · 10mA

Result

Series resistor (exact)

130 Ω

Nearest E24: 130 Ω

Actual If with E24 resistor

10.0 mA(-0.0%)

Power dissipation

Resistor13.0 mW → 1/8 W
LED20.0 mW
10 mA — safe for direct GPIO drive on STM32, nRF52, RP2040

Circuit

3.3VGND130 ΩR1AKIf = 10.0 mA

Quick reference — Red LED (Vf 2 V) at 10 mA

Supply (Vs)R exactR (E24)Actual IfP resistor
1.8 VVs ≤ Vf — won't work
3.3 V130 Ω130 Ω10.0 mA13 mW
5 V300 Ω300 Ω10.0 mA30 mW
12 V1.00 kΩ1.00 kΩ10.0 mA100 mW

How it works

An LED is a diode — it has an exponential I–V curve. Without a current limiting resistor, a small increase in voltage causes a large increase in current, which burns the LED out in milliseconds. The series resistor sets the operating current:

R = (Vs − Vf) / If

Where Vs is the supply voltage, Vf is the LED’s forward voltage at the desired current, and If is the target current. The resistor drops the remaining voltage: Vresistor = Vs − Vf.

Forward voltage (Vf)

Vf varies by LED colour and process — red LEDs are ~2.0 V, blue/white are ~3.2 V. It also varies with current: higher current shifts Vf slightly higher. The datasheet specifies Vf at a given If (typically 20 mA). For indicators running at 5–10 mA, the actual Vf will be slightly lower than the datasheet’s 20 mA figure. For a first-order calculation, use the typical Vf value.

Choosing the current

The maximum rated current for a standard 5 mm LED is typically 20–30 mA. For indicators you rarely need this much:

IfPerceived brightnessNotes
1–2 mADimPanel indicators in dark environments
5 mAModerateGeneral-purpose indicator
10 mABrightMost applications
20 mAVery brightMaximum for standard LEDs

Human eyes are not linear — there is diminishing returns above 5 mA. For most status LEDs, 5–10 mA is sufficient and runs cooler.

Power dissipation

The resistor dissipates P = If² × R watts. At 20 mA through a 150 Ω resistor:

P = (0.020)² × 150 = 0.06 W = 60 mW

A standard 0603 or 0402 resistor is rated 0.1 W (100 mW). This is fine. At 5 V with an IR LED (Vf = 1.3 V) at 100 mA:

R = (5 − 1.3) / 0.1 = 37 Ω  → use 39 Ω (E24)
P = (0.1)² × 39 = 390 mW

Use a 0.5 W or 1 W resistor here, not a 0402.

GPIO drive limits

Microcontroller GPIO pins have a maximum source/sink current. Typical limits:

MCUMax GPIO currentMax total package
STM32F425 mA120 mA
nRF5284015 mA50 mA
RP204012 mA
ATmega328P40 mA200 mA
ESP3212 mA40 mA

For LEDs at 10 mA or less, direct GPIO drive is usually fine. For 20 mA or higher, use a small NPN transistor (e.g. BC847, 2N3904) or an N-channel MOSFET (2N7002) to switch the current from a lower-impedance supply rail. The GPIO then drives the base/gate rather than the LED directly.

Common mistakes

Using no resistor. Even with a current-regulated supply, the LED’s V–I characteristic is so steep that ±100 mV variation in Vs causes ±50% change in current. Always use a resistor.

Ignoring the E24 derating. The exact calculated value (e.g. 173 Ω) is not a stocked value. The nearest E24 is 180 Ω — which reduces current by 4%. Usually fine, but worth checking if you’re targeting a specific brightness spec.

Underrating the resistor. A 0402 or 0603 at 0.1 W is fine for indicator LEDs at 10–20 mA. At higher currents (IR LEDs for proximity sensing, power LEDs) check the dissipation and use a rated part.

Forgetting Vf varies with temperature. At −40 °C, Vf increases by roughly 2 mV/°C. For a blue LED at room temperature Vf = 3.2 V, at −40 °C Vf ≈ 3.33 V. At 5 V supply with a 91 Ω resistor, current drops from 20 mA to 18.5 mA. Probably fine for an indicator; potentially a problem for an IR sensor calibrated at room temperature.