What is the LED Resistor Calculator?
An LED (light-emitting diode) needs a current-limiting resistor in series to prevent it from drawing too much current and burning out. This calculator works out the exact resistor value in ohms from your power supply voltage, the LED's forward voltage, and the desired LED current. It also reports the power the resistor must dissipate so you can pick a part with an adequate wattage rating.
How to use it
Enter three values: the supply voltage feeding the circuit (e.g. 5 V from USB, 9 V from a battery), the LED's forward voltage (typically ~2 V for red, ~3.1 V for blue/white — check the datasheet), and the desired LED current in milliamps (often 20 mA for standard LEDs). The calculator returns the resistance, the voltage dropped across the resistor, and its power dissipation.
The formula explained
By Ohm's law, the resistor must drop the leftover voltage (supply minus the LED's forward drop) at the chosen current: $$R = \frac{V_{supply} - V_{led}}{I_{led}}$$ Current is converted from milliamps to amps by dividing by 1000. Always round up to the nearest standard resistor value to keep current at or below your target.
Worked example
Driving a red LED (\(V_{led} = 2\) V) at 20 mA from a 9 V supply: $$R = \frac{9 - 2}{0.020} = \frac{7}{0.020} = 350\ \Omega$$ The resistor drops 7 V and dissipates \(P = 7 \times 0.020 = 0.14\) W, so a 1/4 W (0.25 W) resistor is fine. The nearest standard value above 350 Ω is 360 Ω or 390 Ω.
FAQ
What if the supply equals the LED voltage? You'd need 0 Ω, but in practice the LED won't light reliably — choose a higher supply voltage.
Why round up? A larger resistor reduces current slightly, which protects the LED. Rounding down risks exceeding the rated current.
What wattage resistor should I buy? Pick at least double the calculated power for headroom — for 0.14 W, a standard 0.25 W resistor is plenty.