How to calculate an LED's series resistor
The series resistor for an LED is R = (V_s − V_f) / I, where V_s is the supply voltage, V_f the LED's forward voltage and I the current you want. For a red LED (V_f = 2.0 V) at 20 mA from a 5 V supply, that is (5 − 2.0) / 0.02 = 150 Ω.
Why an LED needs a series resistor
An LED conducts like any diode, with a current that rises exponentially with voltage, so a small change in voltage produces a large change in current. Connected directly across a supply, a typical LED draws far more than its rating and burns out.
A series resistor fixes this. It sets the current by dropping whatever voltage the LED does not use, which makes the current far less sensitive to small voltage differences.
The LED simulator shows how steep the problem is. With the red LED preset (rated 20 mA at 2.0 V), the model gives 20 mA at 2.0 V, but about 27 mA at 2.1 V and about 34 mA at 2.2 V. A rise of 10% in voltage gives about 70% more current.
The formula
Apply Kirchhoff's voltage law around the loop: the supply voltage equals the LED voltage plus the voltage across the resistor, so V_s = V_f + I × R. Solving for R gives:
R = (V_s − V_f) / I
- V_s is the supply voltage in volts.
- V_f is the LED's forward voltage at the chosen current, from the datasheet.
- I is the desired forward current in amps, at or below the rated current.
Choose I first. The datasheet rating is often 20 mA for a standard 5 mm LED, but a lower current such as 5–10 mA is often bright enough for an indicator, and it is gentler on the LED.
Worked example: red LED on 5 V
Take a red LED with V_f = 2.0 V and a target current of 20 mA, powered from 5 V.
1. Voltage across the resistor: 5 − 2.0 = 3.0 V. 2. Resistance: 3.0 / 0.02 = 150 Ω. 3. Power in the resistor: P = I² × R = 0.02² × 150 = 0.06 W, or equivalently 3.0 V × 20 mA. 4. Power in the LED: 2.0 V × 20 mA = 0.04 W.
150 Ω is a standard E12 value, so it can be used as is. A quarter-watt (0.25 W) resistor has plenty of margin over 0.06 W. If the calculated value is not a standard one, round up to the next standard value. The current then falls slightly below the target, which is the safe direction.
If you want a dimmer LED, choose a lower current: at 10 mA the same supply needs 3.0 / 0.01 = 300 Ω.
Why forward voltage depends on colour
The forward voltage is set mostly by the semiconductor's band gap, which also sets the colour of the light. A wider band gap means a higher forward voltage and shorter wavelength.
The Curvo Studio presets for 5 mm LEDs at 20 mA show the pattern.
- Red (AlGaInP, 625 nm): 2.0 V
- Orange (605 nm): 2.05 V
- Yellow (590 nm): 2.1 V
- Green (InGaN, 525 nm): 3.0 V
- Blue (InGaN, 470 nm): 3.2 V
- White (blue die with phosphor): 3.2 V
The jump between yellow and green happens because the materials change from AlGaInP to InGaN, not because voltage slides smoothly with wavelength. These are typical values. Real parts vary between manufacturers, batches and temperature, so check the datasheet for the LED you are using.
The same formula applies to every colour. A blue LED on 5 V at 20 mA needs (5 − 3.2) / 0.02 = 90 Ω, so the next standard value up is 100 Ω, which gives about 18 mA. On a 3.3 V supply, a blue LED leaves only 0.1 V across the resistor, so the current becomes extremely sensitive to the exact forward voltage, and the calculation stops being reliable.
Power rating and other checks
After choosing the resistor, check three things.
- Resistor power: P = I² × R. Pick a rating of at least twice the calculated power where practical, since it leaves margin and keeps the part cool.
- LED current: never exceed the LED's rated continuous current.
- Reverse voltage: LEDs tolerate little reverse voltage. The presets use a 5 V maximum, and the simulator marks the LED as overloaded in breakdown.
If a supply varies, calculate for its lowest voltage to be sure the LED lights, then check the current at its highest voltage to be sure the LED is safe.
Try it in the LED simulator
Open the LED simulator and choose the red 5 mm preset. The simulator applies a voltage directly across the LED, so the series resistor you calculate is the one you would add outside it. Its own series resistance parameter (12 Ω for this preset) is the LED's internal bulk resistance, not the external resistor.
- Set the applied voltage to 2.0 V and read the current, about 20 mA, the rated value.
- Raise it to 2.1 V and 2.2 V and watch the current climb toward overload.
- Switch to the blue preset and find the voltage that gives 20 mA, which should be 3.2 V.
- Subtract each forward voltage from your supply voltage, divide by 20 mA, and compare the resistor values you get for each colour.
Try it in the simulator
Frequently asked questions
- What is the formula for an LED series resistor?
- R = (V_s − V_f) / I, where V_s is the supply voltage, V_f the LED's forward voltage and I the desired current. For a red LED at 20 mA on 5 V it gives 150 Ω.
- What resistor do I need for an LED on 5 V?
- For a red LED (2.0 V) at 20 mA, use 150 Ω; for a blue or white LED (3.2 V) at 20 mA, use about 90 Ω, so choose the next standard value up, 100 Ω. A lower current needs a larger resistor.
- What power rating should the resistor have?
- Calculate P = I² × R. For the 150 Ω example at 20 mA that is 0.06 W, so a quarter-watt resistor is sufficient.
- Why do different coloured LEDs have different forward voltages?
- The forward voltage depends mainly on the semiconductor band gap, which also determines the colour. Red LEDs are around 2 V and blue, green and white LEDs are around 3 V or more.
- Can I use a larger resistor than calculated?
- Yes. A larger resistor lowers the current, so the LED is dimmer but safe. A smaller resistor raises the current and can exceed the LED's rating.
