NEARFIELD·TOOLS

LED resistor calculator

The resistor is one division. This page also gives you the number that decides whether the circuit is reliable: the headroom left across that resistor, and the current spread it allows once the forward voltage, the supply and the resistor each land anywhere inside their tolerances. With 3 V of headroom a normal ±0.2 V forward-voltage spread moves the current by ±7 %. With 0.3 V of headroom the same LEDs move it by ±67 %, and some of them will not light at all.

Forward voltages are typical figures at about 20 mA for ordinary indicator LEDs, with a spread covering normal part-to-part and bin variation. Your datasheet wins; choose Custom to enter its numbers.

series resistor, exact
buy this one (E24)
LED current
resistor dissipation
headroom
worst-case current
power reaching the LEDs
total supply current
current, nominal parts tolerance band your supply, ± tolerance target current
ResistorLED currentWorst caseDissipation

Every E24 value either side of the answer, because the useful question is usually “what do the resistors already in my drawer give me?” The worst-case column is the current once the forward voltage, the supply and the resistor are all at the ends of their tolerance bands at the same time. The highlighted row is the value this page recommends.

How this is calculated

An LED is a diode, not a resistor. Its current rises exponentially with the voltage across it, so you do not choose the current by choosing a voltage — a few tens of millivolts either way changes the current by a factor of two. What you do instead is put a resistor in series and let it absorb the difference between the supply and whatever forward voltage the LED happens to settle at.

R = (Vsupply − n · Vf) / I

with n the number of LEDs in series. The numerator is the headroom — the voltage left over for the resistor to work with — and it is the single most important number on this page. The dissipation in the resistor is I² R, equivalently I × headroom.

Headroom is what decides whether the circuit is reliable

Differentiate the equation above with respect to the forward voltage and the whole design question falls out in one line:

ΔI / I = n · ΔVf / headroom

The fractional change in current is the change in forward voltage divided by the headroom. That is it. A ±0.2 V forward-voltage spread — completely ordinary for LEDs out of the same reel — becomes:

This is why the same circuit can work perfectly on the bench and fail in production, and why swapping in a different LED from a different reel changes the brightness visibly. Nothing is broken; the headroom was never large enough to absorb the variation that was always there.

The supply and the resistor add their own contributions, and the calculator stacks all three at their worst-case extremes at once. Which one dominates is worth reading off the verdict: on a generous headroom the supply tolerance usually wins, and buying 1 % resistors changes nothing. On a tight headroom the forward voltage wins by a mile, and no resistor tolerance you can buy will rescue it.

The practical rule that comes out of this: aim for a headroom of at least five times the total forward-voltage spread, which keeps the forward-voltage contribution inside ±20 %. Below about 20 % of the supply, start being suspicious. Below 10 %, use a constant-current driver instead, or take an LED out of the string.

Temperature moves the forward voltage too

An LED's forward voltage falls by roughly 2 to 4 mV per °C as the junction warms — more for red AlGaInP parts, less for blue and white InGaN ones. A 40 °C rise inside an enclosure is therefore worth 0.1 to 0.16 V, which is the same order as the whole bin spread, and it moves in the direction that increases the current. On a low-headroom circuit the LED warms, its forward voltage drops, the current rises, and it warms further. With a resistor in series that loop is stable, because the resistor holds the current down; without one it is not, which is the real reason a bare LED across a supply destroys itself rather than merely being over-driven.

Choosing the current: 20 mA is a legacy number

20 mA is the traditional maximum continuous rating of an ordinary 5 mm indicator LED, and it became the default in every tutorial. It is almost never the right choice for a modern part. Efficiency has improved by more than an order of magnitude since that convention formed, and a current high-brightness LED at 20 mA is genuinely painful to look at on a front panel.

For an indicator, start at 2 to 5 mA and work up until it looks right in the light the product will actually live in. The benefits compound: a fifth of the current is a fifth of the battery drain, a twenty-fifth of the resistor dissipation, and it sits far enough below the pin limits of any microcontroller that the wiring stops being a constraint. The only reason to run an indicator at 20 mA is if it has to be read in direct sunlight.

Note that brightness is not proportional to current — perceived brightness follows something much closer to a logarithm, so dropping from 20 mA to 5 mA does not make the LED a quarter as bright. It makes it noticeably dimmer, and usually still too bright.

Never put parallel LEDs on one resistor

It looks like it should work, and it is the most common LED wiring mistake there is. Two LEDs in parallel are forced to the same voltage, and because their current rises exponentially with that voltage, the one with the lower forward voltage takes a wildly disproportionate share of the current.

For ordinary indicator LEDs the current roughly doubles for every 100 mV of forward voltage. So two LEDs 100 mV apart split the current 2:1; 200 mV apart, 4:1; 400 mV apart — the width of a normal ±0.2 V bin spread — 16:1. The calculator models exactly this when you select the shared-resistor option, and the number it reports is the current in the hottest LED, which is the one that decides whether the circuit survives.

It then gets worse on its own. The LED taking the most current dissipates the most power, warms up, its forward voltage falls, and it takes an even larger share. The failure mode is one LED visibly brighter than the rest and eventually dying, after which the survivors inherit its current and the process repeats.

The fix costs one resistor per branch and nothing else. Give every parallel branch its own resistor and the resistors — which are linear and matched to a few percent — set the split instead of the diodes.

Series strings, and how many will fit

Putting LEDs in series is strictly better than putting them in parallel: the same current flows through all of them by definition, so they match automatically, and the resistor wastes less of the supply. Three white LEDs on 12 V pass 9.6 V of the supply to the LEDs and burn 2.4 V in the resistor — 80 % efficient. One white LED on 12 V burns 73 % of the power as heat. That difference is exactly why 12 V LED strips are built in three-LED segments.

The limit is headroom. Each LED you add takes its forward voltage and its share of the forward-voltage spread out of the budget, so the current sensitivity gets worse twice over. The calculator reports how many of your chosen LED this supply will carry while still keeping 20 % of it across the resistor at the low end of the supply tolerance — which is the honest limit, not the one you get by dividing the nominal supply by the typical forward voltage.

Driving an LED from a microcontroller pin

A logic output is not an ideal voltage source. It behaves approximately like the supply rail behind a resistance of a few tens of ohms, and that resistance is in series with everything you calculate. Selecting a microcontroller pin above adds it to the sum, which is why the answer changes.

A 5 V AVR pin — an Arduino Uno — is specified to reach about 4.2 V while sourcing 20 mA, so it looks like roughly 30 to 40 Ω. An ESP32 or an STM32 pin is lower, often 20 to 30 Ω, and configurable on some parts. Three consequences follow:

Most microcontrollers also sink more current than they source, so wiring the LED between the supply rail and the pin and driving the pin low is often the more capable arrangement — at the cost of inverting your logic.

When a resistor is the wrong answer

A series resistor is a current limiter, not a current regulator: it sets the current only as accurately as the headroom allows. Three situations call for something else.

Power LEDs. Anything at 350 mA or above dissipates too much in a resistor to be sensible, and its forward voltage moves enough with temperature that the current would drift as it heats. Use a constant-current driver, which is also far more efficient because it does not have to burn the difference.

A wide supply range. A car's electrical system is 12 V nominal, 12.6 V parked, 14.4 V running and rather more during a load dump. A resistor sized for 12 V is 40 % over current at 14.4 V. Constant-current regulator diodes — two-terminal parts that behave like a current source — solve this for a few tens of milliamps with no more effort than a resistor.

Very low headroom you cannot avoid. A white LED on a single lithium cell is the standard example: the cell runs from 4.2 V down to 3.0 V and the LED needs 3.2 V, so a resistor gives you a light that is bright at the start and dark long before the battery is flat. This is what boost-mode LED drivers are for.

FAQ

What resistor do I need for a red LED on 5 V?

150 Ω gives exactly 20 mA, and it is a standard E12 value. The 220 Ω resistor everybody actually has in their drawer gives 13.6 mA, which is very likely the better-looking indicator anyway. 1 kΩ gives 3 mA, which is plenty for a panel LED indoors.

Does the resistor go before or after the LED?

It makes no difference. The same current flows through every element of a series loop, so the resistor limits it identically on either side. Put it wherever the layout is tidier.

What wattage resistor do I need?

Take the dissipation this page reports and fit a part rated for at least twice it. A 1/4 W resistor run at 1/4 W runs hot enough to discolour a board over time and drifts in value; at half its rating it is comfortable. Almost every indicator LED circuit lands inside a 1/8 W part, and the ubiquitous 1/4 W through-hole resistor is already generous.

Can I use one resistor for two LEDs in series?

Yes — that is the correct arrangement. One resistor per branch, however many LEDs are in that branch. It is only parallel LEDs sharing a resistor that misbehaves.

Why is my blue LED so much dimmer than my red one on the same resistor?

Because the same resistor is giving them very different currents. On 5 V with 220 Ω, a 2.0 V red LED gets 13.6 mA while a 3.2 V blue one gets 8.2 mA — and if the supply sags or the blue LED happens to be a 3.4 V part, it gets 7.3 mA. Different colours need different resistors; this is the whole reason the LED selector above exists.

My LED works on the bench but flickers or varies between boards.

Check the headroom figure. If the resistor is dropping less than about 20 % of the supply, you are seeing forward-voltage variation amplified by the tiny denominator in the sensitivity equation. Add supply voltage, remove an LED from the string, or move to a constant-current driver.

Do I need a resistor if I am using PWM to dim the LED?

Yes, and size it for the peak current, not the average. PWM switches the LED fully on and fully off; during the on time the full current flows and the resistor has to survive it. The average dissipation falls with the duty cycle, but the peak current — the thing that damages the LED — does not.

What about reverse voltage?

LEDs have a low reverse breakdown, commonly specified at only 5 V, and it is not a rating you may exceed. If the LED can see a reverse voltage — an AC source, a reversible connector, an H-bridge — put an ordinary silicon diode in antiparallel across it, or a second LED facing the other way if you want both directions to light.

How does this relate to the other pages here?

The dissipation and worst-case reasoning are the same as on the cable page, and the E12/E24 catalogue rounding is the same code used by the RC and RL filter and LC resonance pages. If you are blinking the LED rather than lighting it, the 555 timer calculator sizes the timing, and its output pin has an output resistance of its own for exactly the reasons described above.