Ohm's law and picking an LED resistor, step by step

How V = I × R and P = I²R choose the resistor for an LED: worked 5 V, 9 V and 12 V examples, rounding to E12 values, power ratings and why a 3.3 V supply is a trap for blue LEDs.

On this page

Almost every first electronics project lights an LED, and almost every first LED either glows dimly, burns out, or quietly cooks its resistor. All three come from skipping one small calculation. This article walks through it with Ohm's law, the way our electronics calculator does it, with worked numbers for common supplies and the mistakes that matter.

Ohm's law in one paragraph

The voltage across a resistor equals the current through it times its resistance: V = I × R. The power it turns into heat is P = V × I, which you can also write P = I² × R or P = V² / R. Two of the four quantities fix the other two. For example, 12 V across 220 Ω gives I = 12 / 220 = 54.5 mA and P = 12 × 0.0545 = 0.65 W: too much for an ordinary 1/4 W resistor, which would run hot and eventually fail.

Why an LED needs a resistor

An LED is not a resistor. Below its forward voltage (about 2 V for red, 2 to 3 V for green, about 3 V for blue and white) almost no current flows; just above it, the current rises extremely steeply. Connect an LED straight to a battery and the current is limited only by the battery's internal resistance: the LED overheats. A series resistor turns that steep curve into a predictable current, because the resistor takes whatever voltage the LED does not.

So the resistor sees V_supply − V_forward, and Ohm's law gives

R = (V_supply − n × V_forward) / I

where n is the number of LEDs in series and I the current you want. Typical indicator LEDs are rated at 20 mA maximum; 5 to 10 mA is often bright enough.

Example 1: a red LED on 5 V

  • Supply 5 V, red LED with V_forward = 2.0 V, target 20 mA.
  • The resistor drops 5 − 2 = 3 V.
  • R = 3 V / 0.020 A = 150 Ω, which happens to be a standard E12 value.
  • Power in the resistor: P = I² × R = 0.02² × 150 = 0.06 W. A 1/8 W (0.125 W) resistor has a 2× margin.

Example 2: a 9 V battery

  • Supply 9 V, same LED, target 15 mA.
  • R = (9 − 2) / 0.015 = 466.7 Ω. That is not a value you can buy.
  • The standard E12 values near it are 390 Ω and 470 Ω. Round up to 470 Ω: the current becomes 7 / 470 = 14.9 mA, slightly under the target. Rounding down to 390 Ω would give 17.9 mA.
  • Power: 0.0149² × 470 = 0.104 W. Double it for margin, 0.21 W, and a 1/4 W resistor is the right part.

The calculator does the rounding for you in any series from E6 to E96, and reports the real current with the chosen value.

Example 3: three LEDs on 12 V

LEDs in series share one current and one resistor, and their forward voltages add up.

  • Three white LEDs at 3.0 V each on 12 V, target 20 mA.
  • R = (12 − 3 × 3.0) / 0.020 = 3 / 0.02 = 150 Ω, P = 0.06 W.
  • A fourth LED would need 12 V by itself, leaving nothing for the resistor: the string would barely light. Keep at least 1.5 to 2 V across the resistor so it can do its job.

The 3.3 V trap

Now a blue LED (V_forward nominally 3.0 V) on a 3.3 V microcontroller pin, target 20 mA: R = 0.3 / 0.02 = 15 Ω. It looks fine on paper. But the forward voltage of real LEDs varies by a few tenths of a volt between parts and with temperature. With a 15 Ω resistor:

Actual V_forwardCurrent
2.8 V33 mA
3.0 V20 mA
3.2 V6.7 mA

The current swings by a factor of five, because the resistor only drops 0.3 V. Compare a 5 V supply with a 100 Ω resistor: the same 2.8 to 3.2 V spread gives 22 to 18 mA. The rule: the more voltage the resistor drops, the more stable the current. If you must run a blue or white LED from 3.3 V, use a lower current and a larger resistor, or a constant-current driver.

Reading the resistor you have

Once you know the value, find it in the drawer. 150 Ω in a 4-band colour code is brown, green, brown (15 × 10), plus gold for ±5 %. 470 Ω is yellow, violet, brown. The calculator's colour code tab converts both ways and draws the bands.

Common mistakes

  • No resistor at all, relying on the LED "being rated for 5 V". Some LEDs have a built-in resistor; most do not. Check the datasheet.
  • One resistor for several LEDs in parallel. Their forward voltages differ slightly, so one hogs the current. Give each LED in parallel its own resistor.
  • Rounding down to the nearest standard value, which raises the current.
  • Ignoring the resistor's power. At 12 V and 20 mA with a single red LED, the resistor drops 10 V and dissipates 0.2 W: a 1/8 W part will overheat.
  • Using the maximum current as the design current. The datasheet's 20 mA is a limit; 10 mA lasts longer and is often bright enough.
  • Forgetting the supply's own variation. A "12 V" car supply can be over 14 V while charging; design for the highest voltage you will see.

For quick unit arithmetic outside the calculator, the scientific calculator is a tab away. Then check the result the way an engineer would: measure the voltage across the resistor and divide by its value to get the real current.

Tools mentioned in this article

Back to the blog