Why an LED needs a resistor
An LED’s current rises very steeply with voltage. A little above its forward voltage, the current can grow large enough to destroy it. A resistor in series takes up the extra voltage and limits the current to a safe value.
How to calculate the resistor
R = (Vs − Vf × n) ÷ I
Vs is the supply voltage, Vf the LED’s forward voltage, n the number of LEDs in series and I the current you want. For one red LED (Vf about 2 V) at 20 mA from 5 V: (5 − 2) ÷ 0.02 = 150 Ω.
If the exact value isn’t a standard part, pick the next higher one, so the current ends up slightly lower. The resistor dissipates (Vs − Vf × n) × I; choose a power rating with at least twice that.
Common values at 20 mA
| Supply | LEDs | Exact | E24 value |
|---|---|---|---|
| 5 V | 1 red (2 V) | 150 Ω | 150 Ω |
| 5 V | 1 blue or white (3.2 V) | 90 Ω | 91 Ω |
| 3.3 V | 1 red (2 V) | 65 Ω | 68 Ω |
| 12 V | 1 red (2 V) | 500 Ω | 510 Ω |
| 12 V | 1 white (3.2 V) | 440 Ω | 470 Ω |
| 12 V | 3 white in series | 120 Ω | 120 Ω |
The forward voltages for each color are typical values. Real parts vary, so check your LED’s datasheet.
Frequently asked questions
What current should I use?
Most 3 mm and 5 mm indicator LEDs are rated for 20 mA, but 5 to 10 mA is usually bright enough for an indicator and saves power. High-power LEDs need much more current; check the datasheet and consider a constant-current driver.
Can LEDs in parallel share one resistor?
It’s best not to. Forward voltages differ slightly between LEDs, so in parallel most of the current flows through the one with the lowest forward voltage, which then wears out sooner. Give each LED its own resistor, or wire them in series.
Does the resistor go on the anode or cathode side?
Either. The resistor and LED are in the same series loop, so the current is the same whichever side the resistor is on.