How to Calculate the Correct Resistor for an LED
Connecting an LED directly to a voltage source will destroy it. Learn how to calculate the current-limiting resistor you need, understand forward voltage and current ratings, and handle different supply voltages and LED colours.
Why LEDs Need a Series Resistor
A Light Emitting Diode (LED) is not ohmic — unlike a resistor, its resistance drops sharply as forward voltage increases. If you connect an LED directly to a supply voltage above its forward voltage, current will increase uncontrollably, typically destroying the LED in milliseconds.
A series resistor limits the current to a safe operating value. Calculating the correct resistor is one of the most common electronics tasks.
The Formula
R = (Vsupply - Vf) / If
Where:
- R = Resistor value in ohms (Ω)
- V_supply = Supply voltage (V)
- V_f = LED forward voltage (V) — from the datasheet
- I_f = Desired LED forward current (A) — typically 20mA for standard LEDs
Forward Voltage by LED Colour
The forward voltage varies by LED colour (determined by the semiconductor material):
| Colour | Typical V_f |
|---|---|
| Infrared | 1.2 V |
| Red | 1.8–2.2 V |
| Orange | 2.0–2.2 V |
| Yellow | 2.0–2.2 V |
| Green | 2.0–3.5 V |
| Blue | 3.0–3.5 V |
| White | 3.0–3.5 V |
| UV | 3.5–4.0 V |
Always check your specific LED's datasheet — these are typical values and can vary significantly by manufacturer and type.
Worked Examples
Example 1: Red LED on a 5V Arduino
Component: standard red LED, V_f = 2.0V, desired current = 20mA (0.02A)
R = (5V - 2.0V) / 0.02A = 3V / 0.02A = 150 Ω
Use the nearest standard E24 value: 150Ω.
Example 2: White LED on a 3.3V microcontroller
Component: white LED, V_f = 3.2V, desired current = 10mA (0.01A)
R = (3.3V - 3.2V) / 0.01A = 0.1V / 0.01A = 10 Ω
This very low resistance means only 0.1V is dropped across the resistor. For better current regulation, consider using a constant-current LED driver, or check that the actual V_f of your LED is within 3.3V.
Example 3: Blue LED on a 9V battery
Component: blue LED, V_f = 3.3V, desired current = 20mA
R = (9V - 3.3V) / 0.02A = 5.7V / 0.02A = 285 Ω
Nearest standard value: 270Ω (runs slightly brighter) or 330Ω (runs slightly dimmer and cooler).
Power Dissipation in the Resistor
The resistor absorbs the voltage not used by the LED:
P = (Vsupply - Vf) × If
For the 9V example: P = 5.7V × 0.02A = 0.114 W
A standard ¼W (0.25W) resistor is fine. If you are running multiple LEDs or high-current LEDs, recalculate — and use at least 2× the calculated power rating for safety margin.
Driving Multiple LEDs
Series connection
LEDs in series share the same current; the supply must be high enough for all forward voltages:
R = (Vsupply - (Vf1 + Vf2 + ...)) / If
3 red LEDs in series (V_f = 2.0V each) on 12V:
R = (12 - 6) / 0.02 = 300 Ω
Parallel connection
Each parallel LED needs its own series resistor to ensure equal current distribution (LEDs have slight forward voltage variations). Never connect LEDs in bare parallel without individual resistors.
PWM Dimming
LEDs are often dimmed using Pulse Width Modulation (PWM) — switching the LED on and off at high frequency (>50Hz). The human eye perceives the average brightness. When dimming with PWM, design the resistor for the full current at 100% duty cycle — the average current will be proportionally lower.
High-Power LEDs
High-power LEDs (1W, 3W, 10W) require dedicated constant-current drivers, not simple resistors. The power dissipated in a resistor would be too high, and their forward voltage varies more with temperature. Use proper LED driver ICs (e.g., AMC7135, PT4115) for high-power applications.