LEDs and Diodes
Learn how diodes and LEDs let current flow one way, identify their legs, and calculate the current-limiting resistor every LED needs.
Welcome back!
Step 1 of 12Learn
The LED that flashed once
Jordan connects a red LED straight to a 9 V battery. It flashes brilliantly for an instant, then goes dark forever, with a faint smell of burnt plastic. Jordan has just learned the number one rule of LEDs the hard way: an LED must always have something limiting its current, usually a resistor.
To see why, you need to understand diodes.
A diode is a one-way valve for current. It lets current flow easily in one direction, from its anode (+) to its cathode (−), and blocks it in the other direction. Diodes protect circuits from batteries inserted backward, convert alternating current to direct current in chargers and protect microcontrollers from the voltage spikes motors create.
An LED (light-emitting diode) is a diode that gives off light when current flows through it. LEDs are efficient, long-lasting and come in every color.
But diodes have a surprising property. Below a certain voltage, called the forward voltage, almost no current flows. Above it, current rises extremely fast with only a small increase in voltage. A red LED might pass almost nothing at 1.5 V, about 20 mA at 2.0 V, and a destructive amount not far above that. Connected straight to 9 V, Jordan's LED had nothing to stop the current from soaring, and it burned out in a flash.
Step 2 of 12Practice · Chart
Typical LED forward voltage by color
Different colors need a different push before they light. Blue and white LEDs need noticeably more.
Which color needs the highest forward voltage?
Tap the bar that answers the question, then press Check.
Step 3 of 12Practice · True or false
An LED connected backward (cathode to +) will light, just more dimly.
Step 4 of 12Learn
Which leg is which?
Because diodes work in only one direction, orientation matters. On a standard through-hole LED:
- The longer leg is the anode (+). It connects toward the positive side of the supply.
- The shorter leg is the cathode (−).
- The plastic rim often has a flat edge on the cathode side.
- Inside the LED, the larger metal piece is usually the cathode, though this isn't guaranteed for every LED.
If the legs have been trimmed, use the flat edge, or test with a multimeter's diode setting.
Ordinary diodes, like the common 1N4001, have a stripe painted near one end. The stripe marks the cathode. In schematics, a diode is drawn as a triangle pointing toward a bar: current flows in the direction the triangle points, and the bar is the cathode, matching the stripe. An LED's symbol adds two small arrows pointing away to show light coming out.
Each diode type has a typical forward voltage:
| Diode | Typical forward voltage |
|---|---|
| Silicon diode | about 0.7 V |
| Red LED | about 1.8–2.2 V |
| Yellow or green LED | about 2.0–2.4 V |
| Blue or white LED | about 2.8–3.4 V |
Blue and white LEDs need more voltage because they emit higher-energy light. Check the datasheet for exact values.
Step 5 of 12Practice · Choose one
On a standard through-hole LED with untrimmed legs, how do you identify the anode (+)?
Step 6 of 12Diagram
Anatomy of a through-hole LED
Tap a shape with to see more.
- 5 mm LED
- Anode (+): longer leg
Connect toward the positive supply, usually through the resistor.
- Cathode (−): shorter leg
Connect toward ground or the battery minus.
- Flat edge on the rim
Marks the cathode side even after the legs are trimmed.
- Tiny chip (die)
The semiconductor junction where the light is actually produced.
- Plastic lens
Shapes and colors the light beam.
Step 7 of 12Learn
Calculating the current-limiting resistor
To light an LED safely, you put a resistor in series with it. The resistor "uses up" the extra voltage and sets the current. The formula is Ohm's law applied to the resistor alone:
R = (V_supply − V_LED) ÷ I_LED
- V_supply is the battery or supply voltage.
- V_LED is the LED's forward voltage.
- I_LED is the current you want, in amps. Many standard 5 mm LEDs are rated for 20 mA maximum; 10–15 mA is often bright enough and gentler on the LED and the battery.
Example: A red LED (2 V) on a 9 V battery at 20 mA: R = (9 − 2) ÷ 0.02 = 7 ÷ 0.02 = 350 Ω. That's not a standard value, so round up to the next common one, 390 Ω. The current becomes 7 ÷ 390 ≈ 18 mA, safely under 20.
Example: A white LED (3.2 V) on 5 V USB at 15 mA: R = (5 − 3.2) ÷ 0.015 = 1.8 ÷ 0.015 = 120 Ω, which happens to be a standard value.
Also check the resistor's power: P = V × I = 7 × 0.018 ≈ 0.13 W in the first example, fine for a quarter-watt resistor.
Each LED needs its own resistor. Sharing one resistor between LEDs connected in parallel usually makes one LED hog the current, because no two LEDs have exactly the same forward voltage.
Step 8 of 12Diagram
Where the 9 V goes in a red LED circuit
Go around the loop: the voltage drops must add up to the supply voltage.
Tap a shape with to see more.
- 9 V battery (+)
Starts the loop at 9 V above the minus terminal.
- Resistor drops 7 V
9 − 2 = 7 V across the resistor; at 20 mA that means R = 7 ÷ 0.02 = 350 Ω.
- LED drops about 2 V
The LED's forward voltage stays roughly fixed.
- Back to (−) at 0 V
All 9 V have been used up around the loop.
Step 9 of 12Try the calculator
LED resistor calculator
Enter the supply voltage, the LED's forward voltage and the current you want. Round the result up to the next standard resistor value.
- Resistor value
- 350 Ω
- Power in resistor
- 0.14 W
Step 10 of 12Practice · Work it out
A green LED with a forward voltage of 2.2 V runs from a 5 V supply. What resistor gives exactly 14 mA, in ohms?
Step 11 of 12Note
Step 12 of 12Practice · What would you do?
What would you do?
You calculate an LED resistor of 270 Ω. Your kit has 220 Ω and 330 Ω resistors. Which should you use?
Lesson complete!