Quick answer
R = (supply voltage − LED voltage) ÷ current. A red LED (2 V, 20 mA) on 5 V needs (5 − 2) ÷ 0.02 = 150 Ω. On 12 V it needs 500 Ω, so use 560 Ω.
How to use the LED Resistor Calculator
- Enter your supply voltage, such as 5 V from an Arduino or 12 V from a car battery.
- Pick the LED color to fill in a typical forward voltage, or enter the value from your LED's datasheet.
- Enter the LED current. 20 mA is common for 5 mm LEDs; 5-10 mA is often bright enough for indicators.
- If several LEDs share one resistor in series, enter how many.
- Press Calculate and use the suggested standard resistor and power rating.
Example
You want to light a red LED (2.0 V, 20 mA) from a 5 V Arduino pin:
R = (5 − 2.0) ÷ 0.020 = 150 Ω
150 Ω is a standard value. The resistor dissipates 0.020² × 150 = 0.06 W, so a common ¼ W resistor is plenty.
Three white LEDs in series on 12 V: R = (12 − 3 × 3.2) ÷ 0.020 = 120 Ω.
How it works
An LED needs a resistor to limit its current. Without one, the current rises until the LED (or your microcontroller pin) is destroyed. The resistor takes the voltage the LEDs don't use:
R = (Vsupply − n × Vf) ÷ ILED
The exact result is rarely a value you can buy, so the calculator rounds up to the next standard value from the E12 and E24 series. A slightly higher resistance means slightly less current, which is the safe direction.
The resistor's power is P = I² × R. The recommended rating is at least double that, so the resistor stays cool.
LED tips from real projects
- You rarely need 20 mA: modern LEDs are bright at 5-10 mA. A higher resistor (330 Ω-1 kΩ on 5 V) saves power and is easier on the eyes.
- Microcontroller pins: keep each Arduino Uno pin under about 20 mA, and aim lower (around 5-10 mA) on 3.3 V boards like the ESP32. A resistor is always required.
- LED strips are different: 12 V and 24 V strips already have resistors built in. Connect them directly to the right voltage.
- Car use: a car's “12 V” system runs at up to 14.4 V while the engine is on. Calculate with 14.4 V to stay safe.
- Which leg is which? The longer leg is positive (anode). The flat edge on the LED rim marks the negative side (cathode).
Frequently asked questions
What happens if I use an LED without a resistor?
The LED draws too much current, overheats and fails, sometimes instantly. It can also damage the pin or power supply driving it. Always use a resistor or a constant-current driver.
Can I use one resistor for several LEDs in parallel?
It's not recommended. LEDs have slightly different forward voltages, so one hogs the current and burns out. Give each parallel LED its own resistor, or wire them in series with one resistor.
What resistor do I need for an LED on 5 V?
For a red LED at 20 mA, about 150 Ω. For blue or white LEDs (3.2 V) at 20 mA, about 90 Ω, so use 100 Ω. For lower brightness, use 220-330 Ω.
What resistor do I need for an LED on 12 V?
For a single red LED at 20 mA, about 500 Ω, so use 560 Ω rated at ¼ W or more. For a white LED, about 440 Ω, so use 470 Ω.
Why use a higher standard value instead of the nearest one?
Rounding up keeps the current at or below your target. The difference in brightness is barely visible, but the LED lasts longer.