Components and Schematics

How to Calculate an LED Current-Limiting Resistor

Use R = (Vs - Vf) / I to size an LED current-limiting resistor. See a worked 5 V example, how to round to a standard value, and how to check power ratings.

On this page
  1. Short answer
  2. Why an LED needs a resistor
  3. Find the three values
  4. Worked example: 5 V supply, red LED
  5. Check the resistor’s power
  6. Round to a standard value
  7. A blue LED example
  8. Several LEDs
  9. Common mistakes

Short answer

Use this formula:

R = (Vs - Vf) / I

  • Vs is the supply voltage across the LED and resistor, in volts.
  • Vf is the LED’s forward voltage, in volts. Take it from the datasheet.
  • I is the current you want through the LED, in amps. For 20 mA, use 0.02 A.

The result is the resistance in ohms. Then choose the next standard value up. A slightly larger resistor lowers the current a little, which is the safer direction.

Why an LED needs a resistor

An LED’s forward voltage stays fairly constant once the LED starts to conduct, so a small change in supply voltage can cause a large change in current. Without a series resistor, the current can keep climbing until the LED fails. The resistor takes up the difference between the supply voltage and the LED’s forward voltage, and that sets the current.

Find the three values

  • Supply voltage (Vs): measure it, or read it from the power source.
  • Forward voltage (Vf): check the LED datasheet. As a rough guide, red, yellow, and amber LEDs are often about 1.8 to 2.2 V, and blue, white, and green LEDs are often about 3.0 to 3.6 V. Use the datasheet value when you have it.
  • Current (I): many standard indicator LEDs are rated for about 20 mA, and some are rated lower. Check the datasheet.

Worked example: 5 V supply, red LED

Assume Vs = 5 V, Vf = 2.0 V, and I = 20 mA (0.02 A).

R = (5 V - 2.0 V) / 0.02 A = 3.0 V / 0.02 A = 150 Ω

150 Ω is a standard value, so you can use it directly.

Check the resistor’s power

The resistor dissipates P = (Vs - Vf) × I. In the example, P = 3.0 V × 0.02 A = 0.06 W, or 60 mW.

A 1/4 W (0.25 W) resistor gives comfortable margin here. As a rule of thumb, choose a power rating at least twice the calculated power.

Round to a standard value

Resistors come in preferred values, such as the E12 and E24 series. If the exact result is not available, choose the next value up.

Example: a 3.3 V board, a 2.0 V red LED, and a target of 10 mA.

R = (3.3 V - 2.0 V) / 0.010 A = 1.3 V / 0.010 A = 130 Ω

130 Ω is not in the E12 series, so use 150 Ω. The current then becomes 1.3 V / 150 Ω, which is about 8.7 mA. That is a safe result, because the current is a little lower than the target.

A blue LED example

Blue LEDs are often about 3.2 V, but the datasheet value should be used. On a 5 V supply at 20 mA:

R = (5 V - 3.2 V) / 0.02 A = 90 Ω

The next standard value up is 100 Ω. The current becomes 1.8 V / 100 Ω = 18 mA.

Several LEDs

  • In series: add the forward voltages of the LEDs together, then subtract that total from the supply voltage. All the LEDs share the same current. The supply must be high enough to cover the total forward voltage plus some drop across the resistor.
  • In parallel: give each LED its own resistor. Small differences in forward voltage can make one LED draw much more current than the others, so sharing one resistor between parallel LEDs is risky.

Common mistakes

  • Connecting an LED straight to a supply without any resistor.
  • Using the supply voltage instead of the difference, Vs - Vf.
  • Mixing up milliamps and amps. 20 mA is 0.02 A, not 20 A.
  • Driving an LED straight from a microcontroller pin without checking the pin’s current limit in the datasheet.

For reading the value of the resistor you buy, see resistor color codes. LEDs are a type of diode, covered in types of diodes. For the LED symbol on a drawing, see electrical diagrams and schematic symbols.

The complete guide to components and schematics

Electronic Components Explained: Active vs Passive
Read the guide

Keep exploring

Guides from other topics

All topics →