On this page
A red LED, a 9 V battery and one resistor make a classic first circuit, and the resistor is the part people are tempted to skip. The calculation takes one line.
What is the formula for an LED resistor?
The series resistor for an LED is R = (Vs - Vf) / If, where Vs is the supply voltage, Vf is the LED's forward voltage and If is the current you want, as set out in SparkFun's resistor tutorial.
The forward voltage is the voltage the lit LED takes up. The same guide says it is usually somewhere between 1.7 V and 3.4 V, depending on the colour, and that the maximum forward current for basic LEDs is usually around 20 mA (SparkFun).
A basic red 5 mm LED is listed with a 1.8-2.2 V forward drop, a maximum current of 20 mA and a suggested current of 16-18 mA (SparkFun product page). So 20 mA is a ceiling, not a target.
How do you calculate the resistor for a red LED on 9 V?
Work it in this order:
Supply voltage: Vs = 9 V.
LED forward voltage: Vf = 2 V, mid-range for the red LED on the SparkFun product page (20 mA maximum, 16-18 mA suggested).
Voltage left for the resistor: 9 - 2 = 7 V.
Current in amperes, not milliamperes: 20 mA = 0.020 A.
Resistance: R = 7 / 0.020 = 350 ohms.
Pick a real resistor. Shops sell standard values from the E series defined in IEC 60063, and the E12 series runs 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 in each decade (E series reference). 350 is not on the list, so the neighbours are 330 and 390 ohms.
Check both. With 330 ohms the current is 7 / 330 = 21.2 mA, which is above the 20 mA maximum. With 390 ohms it is 7 / 390 = 17.9 mA, inside the suggested 16-18 mA. Choose 390 ohms.
Check the resistor's power: P = V x I = 7 x 0.0179 = 0.13 W, so a 0.25 W resistor is enough.
Why can't you connect an LED straight to a battery?
Because nothing in the circuit would set the current. SparkFun's LED tutorial warns that an LED connected directly to a current source "will try to dissipate as much power as it's allowed to draw, and... it will destroy itself" (SparkFun LED tutorial).
The reason is the shape of the LED's current-voltage curve. An LED's voltage-current relationship is exponential, so a small increase in voltage causes a large increase in current (Luxeon Star LEDs). The same source gives figures for a typical white LED: about 100 mA at 2.9 V, about 350 mA at 3.1 V and more than 700 mA at 3.3 V.
It also explains thermal runaway: too much current heats the LED, which lowers its forward voltage, which lets even more current flow, and this "happens in seconds" (Luxeon Star LEDs).
Put a 2 V LED straight across 9 V and it would have to take all 9 V, far past the knee of its curve. The resistor is what takes up the extra 7 V.
How much does the current change with a different LED or a weaker battery?
This is where the resistor earns its place. With 390 ohms on 9 V, using the 1.8-2.2 V range from the SparkFun product page:
an LED that drops 1.8 V gets (9 - 1.8) / 390 = 18.5 mA
an LED that drops 2.2 V gets (9 - 2.2) / 390 = 17.4 mA
if the battery sags to 8 V, a 2 V LED gets (8 - 2) / 390 = 15.4 mA
A 0.4 V spread in the LED moves the current by about 1 mA, while in the white LED figures above a 0.2 V change multiplied it several times. The resistor works as feedback: if the current rises, the voltage across the resistor rises too, leaving less for the LED.
The diagram above shows this as a load line crossing the LED's steep curve at 2 V and 20 mA. If the idea of a forward voltage is new to you, the Fermi Concept Library has every concept in physics, chemistry, biology, mathematics and computing, each with its own lesson.
How do you check your answer in an exam or a lab?
Resistor voltage plus LED voltage equals the supply voltage.
Current was converted to amperes before dividing.
The chosen standard value keeps the current at or below the LED's maximum.
The resistor's power rating is above V x I.
If you lose track of which voltage goes where in a textbook problem, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Next time, do the eight steps on paper, then measure the current with a multimeter.



