FirmGod

LED Series Resistor Calculator

Pick the standard resistor for an LED, see the current it really gives, the worst case across tolerance and Vf spread, and the power rating it needs.

Volts.

Vf from the datasheet, at this current.

Milliamps.

±5% parts

Typical Vf:

Closest standard resistor

R = 150 Ω, 125 mW (1/8 W)
20 mA (on target) — worst case 19 mA to 21.1 mA with ±5% parts
Ideal resistor150 Ω
Headroom (supply − Vf)3 V
Resistor dissipation60 mW → use 125 mW (1/8 W)
LED dissipation40 mW
If Vf runs 0.1 V high19.3 mA

Standard values either side

The smaller value pushes more current than you asked for; the larger one is the safe choice. Pick by which matters more for this LED.

ResistorCurrentvs targetWorst caseResistor WRating
130 Ω23.1 mA+15.4%22 mA – 24.3 mA69.2 mW250 mW (1/4 W)
150 Ωnearest20 mAexact19 mA – 21.1 mA60 mW125 mW (1/8 W)
160 Ωsafe18.8 mA-6.3%17.9 mA – 19.7 mA56.2 mW125 mW (1/8 W)

The resistor sets the current, not the LED

An LED does not have a resistance to speak of. Below its forward voltage almost nothing flows; above it the current climbs steeply enough that a supply a few tenths of a volt too high will destroy the part. So the circuit has to set the current from outside, and the simplest way is a resistor in series: the supply minus the LED's forward voltage is dropped across the resistor, and Ohm's law does the rest.

R = (Vsupply − Vf) / If. For a red LED at 2.0 V and 20 mA from 5 V, that is 3 V over 20 mA, or 150 Ω. The arithmetic is not the hard part.

Vf is a range, not a number

The hard part is that Vf on a datasheet is a typical figure with a minimum and maximum around it, often a range of half a volt, and it moves with temperature and with current. Two LEDs from the same reel can differ by a tenth of a volt or more. Whatever value you design against, the part on the board will be somewhat different.

How much that matters depends entirely on headroom — the voltage the resistor has to work with. From 5 V with a 2 V LED there is 3 V of headroom, and a 0.1 V shift in Vf changes the current by about 3%. From 3.3 V with a 3.2 V white LED there is 0.1 V of headroom, and the same shift doubles the current or turns the LED off. The tool reports both the headroom and the current at Vf + 0.1 V so this sensitivity is visible before the board is built. When the headroom is under a volt, the honest answer is usually a higher supply or a constant-current driver rather than a more carefully chosen resistor.

Round up, not to nearest

The ideal resistance is rarely a value that exists. With E24 parts, 90 Ω lands between 82 and 91; with E96, between 88.7 and 90.9. Rounding down gives more current than intended, rounding up gives less. For an LED the asymmetry matters: slightly dim is harmless, slightly hot shortens the life and shifts the colour. Unless the target current is well inside the LED's rating, take the larger value.

The tool shows the standard values on both sides with the current each produces, and marks the one that stays under target. It also shows the worst case across the resistor's own tolerance, which for ±5% parts is another ±5% on the current.

Power rating and the 50% rule

The resistor dissipates I²R. At 20 mA and 150 Ω that is 60 mW, comfortably inside a 1/8 W part. At 100 mA through 33 Ω it is 330 mW, and a 1/4 W resistor would be running past its rating. A resistor at full rating is hot to the touch, drifts in value, and ages; the usual practice is to pick a rating at least twice the dissipation, which is what the recommendation here does.

Surface-mount ratings are set by the package rather than printed on the part: 0603 is typically 100 mW, 0805 125 mW, 1206 250 mW. Check the manufacturer's figure — it varies — and derate it if the board runs warm.

Several LEDs: series, not parallel

LEDs in series share one current, so one resistor sets it for all of them. Their forward voltages add, which is why the tool subtracts N × Vf from the supply. Three 3.2 V white LEDs need 9.6 V before the resistor sees anything, so a 12 V supply leaves 2.4 V of headroom — workable, but tighter than it looks.

LEDs in parallel on one resistor do not share current evenly. The LED with the lowest Vf takes the most, warms up, and its Vf drops further; the imbalance grows until that LED fails, at which point the others take its share and the next one goes. Each parallel branch needs its own resistor.

Driving from a microcontroller pin

A GPIO pin is not the supply rail. When it sources current its output voltage sags — the datasheet VOH figure might be 4.2 V at 20 mA on a 5 V part, or 2.4 V at 8 mA on a 3.3 V part. Use that figure as the supply in the calculation, not the rail. Pins also have limits, commonly 8 to 25 mA each with a smaller total across the port. For a bright LED, or several, switch them with a transistor or a driver and let the pin carry only the base or gate current.

For dimming, drive the pin with PWM rather than changing the resistor; the timer prescaler calculator works out the register values for a given PWM frequency. For a fixed reference voltage rather than a current, the voltage divider calculator uses the same standard-value tables.

Frequently asked questions

Why does an LED need a resistor at all?

An LED is a diode: its current rises exponentially with voltage, so a few tenths of a volt above Vf is the difference between glowing and burning out. The resistor turns the supply into a rough current source — it drops whatever voltage is left over, and the current is that voltage divided by the resistance. Without it there is nothing to limit the current except the supply and the LED itself.

Should I round to the nearest value or the next one up?

Up is the safe direction: a larger resistor means less current, and an LED run a little dim is fine while one run a little hot ages fast. Nearest is fine when the difference is a couple of percent and the LED is rated well above the target. The tool shows both so you can see what each costs.

The datasheet gives Vf as a range. Which number do I use?

Design with the typical value, then check the extremes. The tool shows what happens if Vf runs 0.1 V high, which is a normal part-to-part spread. If that changes the current by more than you can accept, the fix is more headroom — a higher supply — not a more precise resistor.

What power rating does the resistor need?

Power is I²R. 20 mA through 150 Ω is 60 mW, which a 1/8 W part handles with room to spare. The tool recommends the smallest standard rating that leaves at least twice the dissipation in hand, because a resistor run at its full rating gets hot enough to drift. For surface-mount parts, 0603 is typically 100 mW, 0805 125 mW and 1206 250 mW.

Can I put several LEDs on one resistor?

In series, yes: their forward voltages add and one resistor sets the current for all of them, which is what the LED count field calculates. In parallel, no. Each LED has a slightly different Vf, and the one with the lowest takes most of the current, overheats, and shifts even lower. Give each parallel string its own resistor.

Why is my LED dim when driven from a microcontroller pin?

Two reasons. A pin does not deliver the full supply voltage when sourcing current — check the VOH figure in the datasheet at the current you are drawing, and use that as the supply here. And pins have a current limit, often 8 to 20 mA, with a total budget across all pins. For anything brighter, switch the LED with a transistor or a driver.

The code behind this

The arithmetic on this page is published as the ledresistor module — the same functions you are using here, with the same tests. MIT, no dependencies.

Read the sourceOn npmnpm i electronics-math