LED series resistor

Series resistor (Vs − Vf) ÷ I
Power in the resistor
Power in the LED
Share of the power used by the LED

An LED's current climbs steeply once its voltage passes the forward voltage, so it can't be connected straight to a battery: the resistor takes up the rest of the supply voltage and sets the current. The higher the supply, the more of the power the resistor turns into heat.

The formulas

Take the forward voltage and the current from your LED's datasheet: they differ by colour, type and maker, and the current must stay within the datasheet's maximum. The model treats the forward voltage as fixed; a real LED's voltage rises a little with current, so the true current comes out slightly lower. Choose a resistor whose power rating is comfortably above the power shown. If the supply is at or below the forward voltage, no resistor works and the LED stays dark. Tested: the resistor value is checked by solving the loop numerically with an exponential diode model that passes the chosen current at the forward voltage, and the powers balance (packages/mechanics/test/science.test.ts).

Example

With supply voltage 9 V, LED forward voltage 2 V, LED current 20 mA: series resistor (Vs − Vf) ÷ I: 350 Ω; power in the resistor: 140 mW; power in the LED: 40 mW; share of the power used by the LED: 22.2% of the supply power. Open this setup, then change one thing at a time.

Related: Voltage divider · RC circuit · RL circuit