LEDs and the series resistor

Why an LED needs a resistor, how to calculate it for any supply voltage, forward voltages by colour, and the mistakes that kill LEDs and microcontroller pins.

6 min readUpdated 2 Sept 2026
ShareWhatsApp

This is the first circuit almost everybody builds, and it is also where the first component gets destroyed. Both facts come from the same property: an LED does not limit its own current.

Why the resistor is not optional

A resistor obeys Ohm's law — double the voltage and you double the current. An LED does not. Below its forward voltage it passes almost nothing; above it, the current climbs almost vertically for a few tenths of a volt more. There is no comfortable operating point in between.

Current against voltage for an LED. The current stays near zero until the forward voltage, then rises almost vertically, which is why a series resistor is needed to set it.IVVfalmost nothing hereand everythinghere
Current against voltage. Nothing happens until Vf, and past it the curve is nearly vertical — which is why the resistor, not the LED, has to set the current.

Connect a red LED straight across 5 V and the supply will push whatever current it can manage through it. The die overheats in a fraction of a second. Sometimes it goes dark immediately; more often it glows very brightly for a moment and then fades over the following minutes, which is why people conclude they were sold a bad LED.

The resistor's job is to take up the difference between the supply and the LED's forward voltage, and to set the current by doing so. It is the part actually in control.

The calculation

R = (Vs - Vf) / If

  • Vs — the supply voltage
  • Vf — the LED's forward voltage, which depends on its colour
  • If — the current you want through it, in amps

A red LED on 5 V at 10 mA. Red drops about 2 V, so the resistor must drop the other 3 V:

R = (5 - 2) / 0.010 = 300 ohms

300 is not a preferred value. Round up to 330 — up, not down, because a larger resistor means less current, and the failure mode of too little current is a slightly dim LED rather than a dead one.

P = (Vs - Vf)² / R = 9 / 330 = 0.027 W

Well inside a quarter-watt resistor. Almost always is, at these currents.

LED resistor calculator

Open on its own page

It rounds up to a resistor you can buy, then tells you the current you will really get.

Calculated
300 Ω
(Vs − Vf) ÷ I
Fit this one
300 Ω
Nearest preferred value at or above the calculation — rounding up means slightly less current, never more.
Actual current
10 mA
What the LED will really draw with that resistor.
Resistor power
30 mW

Forward voltage by colour

Vf is set by the semiconductor the die is made from, and that is what determines the colour — so colour predicts voltage. These are typical figures for ordinary 5 mm and 3 mm indicator LEDs; the datasheet wins if you have one.

ColourTypical VfNote
Infrared1.2 - 1.4 VRemote controls, obstacle sensors
Red1.8 - 2.2 VThe lowest of the visible colours
Orange / Amber2.0 - 2.2 V
Yellow2.1 - 2.2 V
Green (standard)2.0 - 2.4 VThe older, dimmer green
Green (bright)3.0 - 3.4 VModern high-brightness — behaves like blue
Blue3.0 - 3.4 V
White3.0 - 3.4 VA blue die with a phosphor coating

Blue, white and bright green will not light properly from a 3 V coin cell, and that surprises people. There is not enough voltage left over for a resistor to do anything with.

How much current do you actually want?

The textbook answer is 20 mA, and the textbook is describing the maximum a standard LED will take continuously, not a target. Modern LEDs are far brighter than the parts that number was written for.

  • 2 - 5 mA is plenty for an indicator on a board that sits indoors. It will still be clearly lit.
  • 10 mA is a comfortable general-purpose figure, and the one to use if you are unsure.
  • 20 mA is the usual maximum for a 5 mm LED, and worth it only when the thing must be readable in daylight.

Ready-made answers

Nearest preferred value above the calculation, at about 10 mA. Use these and move on.
SupplyRed / Yellow (2 V)Blue / White / Bright green (3.2 V)
3.3 V150 ohmsMarginal — use 10 ohms to 33 ohms, or a boost
5 V330 ohms220 ohms
9 V680 ohms680 ohms
12 V1k1k
24 V2k22k2 (check the resistor's power rating)

At 24 V the resistor drops 22 V and dissipates about 0.22 W, so a quarter-watt part is running at its limit. Fit a half-watt one.

Which lead is which

An LED is a diode and only works one way round. Fitted backwards it simply does not light — no harm done at these voltages, and this is worth knowing because a dead-looking LED is usually a reversed one.

  • The longer lead is the anode, the positive side. Long lead, long word.
  • The flat spot on the rim marks the cathode, the negative side. This one survives having the leads trimmed.
  • Inside the package, the larger metal cup is the cathode. Hold it up to the light if the flat has worn away.

Four mistakes that cost components

  1. 1

    Two LEDs in parallel, sharing one resistor

    They never share equally. The one with the slightly lower forward voltage takes most of the current, runs hotter, and its Vf falls further as it warms — so it takes even more. One LED ends up bright and short-lived, the other dim. Give each LED its own resistor.

  2. 2

    LEDs in series without checking the supply

    Series is fine and efficient — the same current does two jobs — but the forward voltages add. Three white LEDs need 9.6 V before a resistor gets a look in, so they will not run from 5 V at all.

  3. 3

    Driving too many from one microcontroller

    An Arduino Uno pin is rated at 20 mA continuous, 40 mA absolute maximum, and the whole chip is limited to about 200 mA total. Eight LEDs at 20 mA is 160 mA through one ground pin. Use a transistor or a driver IC once you are past two or three.

  4. 4

    Forgetting that the pin voltage is not the supply

    A 3.3 V board drives its pins to 3.3 V, not 5 V. Calculate with the voltage the pin actually produces, or the LED will be dimmer than you expected — and a blue LED may not light at all.

What you need for this

Everything above works with parts from anywhere. These are what we stock, if it is easier.

Read next

Written by us for projectkit.in. If you spot something wrong, tell us — a reference page that is confidently wrong is worse than no page, and we would rather hear it from you than from a viva panel. Back to the Knowledge Base.

WhatsApp