Why an LED needs a resistor at all
An LED is a diode, and a diode does not obey Ohm's law. Above its forward voltage its current rises almost vertically with voltage: a tenth of a volt too much can double the current. Connect a 2 V red LED straight across a 5 V rail and nothing limits the current except the wiring resistance and the die itself, so the junction overheats in milliseconds. The resistor exists to convert that vertical relationship into a controlled one.
The trick is that the resistor and the LED carry the same current while sharing the supply voltage between them. The LED takes whatever voltage its physics demands — call it Vf — and the resistor is left with everything else. Because the resistor does obey Ohm's law, the current is now fixed by a division you control: the leftover voltage divided by the resistance you chose. Change the resistor and you change the current predictably.
That leftover voltage is the quantity that matters most in this design, and it is worth naming: it is the headroom. Everything good about a resistor-fed LED comes from having enough headroom, and every problem comes from having too little. A 5 V rail feeding a 2 V LED leaves 3 V of headroom, which is generous. A 3.3 V rail feeding a 3.2 V white LED leaves 0.1 V, and at that point the LED's own manufacturing spread rather than your resistor decides the current.
The formula, term by term
Subtract the total LED drop from the supply, then divide by the current you want. That is the whole calculation, and each of the three terms has a practical catch.
The supply voltage is the voltage at the actual node, not the nominal rail. A microcontroller output pin driving an LED sits perhaps 0.3–0.7 V below its rail because of the output driver's own resistance; the datasheet gives that drop as an output-low or output-high voltage at a stated current. A 12 V lead-acid battery sits nearer 12.6 V at rest and above 14 V while charging, which is why automotive LED circuits are designed at the charging voltage rather than the nominal one.
The forward voltage is a function of current, chemistry and temperature, not a constant. Datasheets specify it at a test current — usually 20 mA for indicator parts — and quote a range rather than a value, because the spread across a production reel is real. Aluminium-gallium-indium-phosphide reds and ambers land near 2 V; indium-gallium-nitride blues, greens and whites land near 3.2 V. Forward voltage also falls as the die heats, which is one reason a hot LED draws more current than a cold one on the same resistor.
The forward current is your choice, bounded above by the absolute maximum in the datasheet. Twenty milliamps became the default because that is where indicator LEDs are characterised, but modern high-efficiency parts are visibly bright at 2 mA and running them there cuts the resistor dissipation by a factor of ten. When several LEDs are wired in series they all carry the same current, so one resistor serves the whole chain — which is exactly why series wiring is more efficient than giving every LED its own resistor from the same rail.
Multiply the headroom by the current and you have the resistor's dissipation, which is the second half of the answer. A resistor that is electrically correct and thermally undersized fails just as surely as a wrong value. The same power arithmetic appears in the electrical power calculator, and if you are combining several resistors to reach a value you do not stock, the series resistance calculator and parallel resistance calculator will get you there.
Worked example: one red LED on a 5 V Arduino pin
You want a standard red indicator at 20 mA from a 5 V rail. The datasheet gives a forward voltage of 2.0 V at 20 mA.
- LED drop. One LED in series, so the string drops n × Vf = 1 × 2.0 = 2.0 V.
- Headroom. VR = 5.0 − 2.0 = 3.0 V, which is 60% of the supply.
- Exact resistance. R = 3.0 ÷ 0.020 = 150 Ω.
- Standard value. 150 Ω is itself an E24 preferred value, so you fit 150 Ω and the current stays at exactly 20 mA.
- Dissipation. P = 3.0 × 0.020 = 0.060 W.
- Rating. Double it for margin: 0.12 W, so the smallest standard rating that clears it is 0.125 W — the ubiquitous eighth-watt part.
Now change one thing: a 9 V supply, a green LED at 2.1 V and 15 mA. Headroom is 9 − 2.1 = 6.9 V, so R = 6.9 ÷ 0.015 = 460 Ω. There is no 460 Ω in E24; the values either side are 430 Ω and 470 Ω. Round up to 470 Ω, because rounding down would push the current above the figure you specified. The LED then draws 6.9 ÷ 470 = 14.68 mA, about 2% under target and invisible to the eye. The resistor now dissipates 6.9 × 0.01468 = 0.101 W, so twice that is 0.203 W and you need a quarter-watt part — not the eighth-watt you used before. The higher supply did not change the LED at all; it changed the resistor's job from 60 mW to 101 mW.
Reading the result: headroom, tolerance and heat
Check the headroom percentage first. As a working rule, keep at least 15–20% of the supply across the resistor. The reason is a sensitivity argument you can do in your head: the current is headroom divided by resistance, so a 0.2 V shift in forward voltage changes the current by 0.2 divided by the headroom. With 3 V of headroom that is a 7% shift; with 0.5 V of headroom the same 0.2 V shift is a 40% swing, and two LEDs from the same reel will visibly differ in brightness. This is why the calculator warns below 15% and why designers of 3.3 V white-LED circuits use a boost converter or a constant-current driver instead of a resistor.
Then check the actual current against what you asked for. Rounding up to a preferred value always lands you at or below your target, never above, so the standard value is the safe direction to move. If the shortfall bothers you, switch the calculator to E24 rather than E12 or E6 — the finer ladder gets you closer — or put two resistors in series.
Finally check the wattage. The rule of running a resistor at no more than half its rating is not a code requirement; it is a temperature argument. A film resistor's temperature rise is roughly proportional to the power it dissipates, so running one at half its rating roughly halves the rise. A quarter-watt part taking a full quarter watt in still air gets hot enough to discolour the board and shorten the life of anything beside it. For anything above about a watt, plan for airflow or a wirewound part on a heatsink, and seriously consider whether a switching driver is the better answer.
Dropping resistor at 20 mA for one LED
| Supply | High-efficiency red, Vf = 1.8 V | Standard red / yellow, Vf = 2.0 V | Blue / white, Vf = 3.2 V |
|---|---|---|---|
| 3.3 V | 75 Ω | 65 Ω | 5 Ω — too little headroom to use |
| 5 V | 160 Ω | 150 Ω | 90 Ω |
| 9 V | 360 Ω | 350 Ω | 290 Ω |
| 12 V | 510 Ω | 500 Ω | 440 Ω |
| 24 V | 1,110 Ω | 1,100 Ω | 1,040 Ω |
The 3.3 V blue cell shows why the headroom check matters: 0.1 V across the resistor means the LED's own forward-voltage spread, not your resistor, sets the current. On a 24 V rail the opposite problem appears — the resistor takes between 87% and 93% of the supply voltage depending on the LED, and therefore that share of the power, which is the argument for putting several LEDs in series.
Mistakes that burn out LEDs or resistors
- Treating forward voltage as a fixed number. Datasheets give a range and a test current. Design at the maximum of the range if you care about worst-case brightness, and at the minimum if you care about worst-case current.
- Rounding the resistor down. A 430 Ω where the calculation said 460 Ω raises the current by 7%. Always round up to the next preferred value; the resulting dimming is invisible and the margin is free.
- Sharing one resistor between parallel LEDs. LEDs in parallel do not share current equally, because the one with the lowest forward voltage takes the largest share and then heats, which lowers its forward voltage further. Give every parallel string its own resistor.
- Sizing the resistor at the nominal battery voltage. A 12 V vehicle system runs above 14 V while the alternator is charging, and load-dump transients go far higher. Design at the charging voltage and protect against transients separately.
- Ignoring the microcontroller pin's own drop and current limit. Most GPIO pins are specified for a few tens of milliamps each, with a lower total limit across the whole port. Driving several LEDs directly from adjacent pins can exceed that total even when each pin is inside its own limit.
- Using a resistor with a 1 W or 3 W LED. High-power LEDs need a constant-current driver. A resistor sized for the nominal forward voltage lets the current run away as the die heats and the forward voltage falls.
Where the preferred resistor values come from
The 10, 11, 12, 13, 15, 16, 18… ladder is not arbitrary. It is the E-series of preferred numbers defined in IEC 60063, built so that each decade is divided into 6, 12, 24, 48, 96 or 192 steps spaced geometrically. E24 has 24 values per decade and pairs with 5% tolerance parts, so that consecutive values just about touch at their tolerance limits and no value is unreachable. E12 pairs with 10% parts and E6 with 20% parts. This calculator rounds onto whichever ladder you select, always upward, so the LED current stays at or below the figure you asked for.
When a resistor is not the right current limiter
A resistor is the right answer when the headroom is a reasonable fraction of the supply, the current is modest, and the supply voltage is stable. That covers indicator LEDs, panel lighting, status displays and almost everything on a hobby board.
Three situations call for something else. When the supply voltage varies widely — a battery falling from 4.2 V to 3.0 V over a discharge, or a vehicle rail moving between 12 V and 14.5 V — the current through a fixed resistor tracks that variation directly, and a constant-current driver holds it steady instead. When the LED is a high-power emitter of a watt or more, the thermal feedback between forward voltage and die temperature makes resistor limiting unstable, and every serious luminaire uses a current-regulated driver. And when the headroom is a large fraction of a high supply, the resistor simply wastes the difference as heat: on a 24 V rail feeding one 3.2 V LED, roughly 87% of the input power leaves as warmth rather than light, which is why long strips wire LEDs into series groups of six or seven with one resistor per group.
For the supporting arithmetic around an LED circuit, the Ohm's law calculator handles the basic V, I and R relationships, the voltage divider calculator sizes bias networks, and the 555 timer calculator sets the blink rate if you want the indicator to flash.
Key terms
- Forward voltage
- The voltage an LED drops when it is conducting, specified in the datasheet at a stated test current. It varies with chemistry, current and temperature, and it is quoted as a range because production spread is real.
- Headroom
- The supply voltage left over after subtracting the total LED drop, which is the voltage across the resistor. Larger headroom makes the current less sensitive to forward-voltage variation.
- E-series
- The IEC 60063 ladders of preferred component values — E6, E12, E24, E48, E96, E192 — spaced geometrically so each decade divides into that many steps.
- Derating
- Running a component below its rated limit on purpose to keep it cool. A resistor operated at half its power rating runs substantially cooler than one at the rating.
