An LED needs a resistor, and the formula for it fits on one line. What the formula hides is that the LED’s own voltage is not one number. The datasheet for a common 5 mm red, green and blue LED lists a typical forward voltage and a maximum, and the gap between them decides how much current the LED really gets, and whether a blue or green LED lights at all on a 3.3-volt board. The numbers below come from two Kingbright datasheets, and every resistor value was computed and checked in code.
Why an LED needs a resistor
A diode is not a resistor
HyperPhysics describes Ohm’s law as the observation that, for many conductors, the current is directly proportional to the voltage applied to them, with resistance as the constant ratio. An LED is not one of those conductors. Below its forward voltage it passes almost nothing; slightly above it, current rises steeply. Connected straight to a supply higher than its forward voltage, an LED draws as much current as the supply can give, and the LED is usually what fails. The earlier post on how LEDs make light covers why the forward voltage exists at all.
The resistor sets the current
A resistor in series takes up the difference between the supply voltage and the LED’s forward voltage. That difference across a known resistance fixes the current:
R = (V_supply − V_forward) / I

The datasheet numbers
What the LED makers specify
Kingbright’s datasheet for its WP154A4SUREQBFZGW, a 5 mm LED with red, blue and green chips in one package, gives forward voltages at 20 mA:
| Color | Typical V_F | Maximum V_F | Max DC current |
|---|---|---|---|
| Hyper Red | 1.9 V | 2.5 V | 30 mA |
| Blue | 3.3 V | 4.0 V | 30 mA |
| Green | 3.3 V | 4.1 V | 25 mA |
A single-color red LED from the same maker, the WP7113SRD/D, lists 1.85 V typical and 2.5 V maximum at 20 mA, with a DC forward current limit of 30 mA and a power dissipation limit of 75 mW. The pattern is consistent: red LEDs need under 2 volts, blue and green ones over 3, and every part varies from unit to unit within its range.
Working it out at 5 volts
Red at 20 mA
With a 5 V supply and the red LED’s typical 1.9 V:
R = (5.0 − 1.9) / 0.020 = 155 Ω
155 ohms is not a standard value. In the common E12 series, the neighbors are 150 and 180. Rounding up to 180 Ω is the safe direction, because a larger resistor means less current. With 180 Ω, the current at the typical forward voltage is 17.2 mA.
The spread
The same 180 Ω with an LED at the datasheet’s maximum 2.5 V gives (5.0 − 2.5) / 180 = 13.9 mA. Two LEDs from the same reel, on the same resistor, can run at 17.2 mA and 13.9 mA, a visible difference in brightness when they sit side by side.
Blue and green at 20 mA
For the blue and green chips at 3.3 V typical, (5.0 − 3.3) / 0.020 = 85 Ω, rounded up to 100 Ω. That gives 17.0 mA at the typical voltage. At the blue chip’s 4.0 V maximum, the current falls to 10.0 mA, and at the green chip’s 4.1 V maximum, to 9.0 mA, barely half the typical value. The closer the forward voltage is to the supply, the more the LED’s own variation dominates the current.
The full table at 5 V
| LED | Target | Calculated | E12 value | I at typical V_F | I at max V_F |
|---|---|---|---|---|---|
| Red | 20 mA | 155 Ω | 180 Ω | 17.2 mA | 13.9 mA |
| Red | 10 mA | 310 Ω | 330 Ω | 9.4 mA | 7.6 mA |
| Blue | 20 mA | 85 Ω | 100 Ω | 17.0 mA | 10.0 mA |
| Blue | 10 mA | 170 Ω | 180 Ω | 9.4 mA | 5.6 mA |
| Green | 20 mA | 85 Ω | 100 Ω | 17.0 mA | 9.0 mA |
| Green | 10 mA | 170 Ω | 180 Ω | 9.4 mA | 5.0 mA |
Indicator LEDs are usually bright enough at 5 to 10 mA, which halves the power and the heat compared with 20 mA.

The 3.3-volt problem
Red works; blue and green do not
Many microcontroller boards run at 3.3 V. For the red chip, (3.3 − 1.9) / 0.020 = 70 Ω, rounded up to 82 Ω, giving 17.1 mA typical and 9.8 mA at the 2.5 V maximum. Workable.
For blue and green, the typical forward voltage is 3.3 V, the same as the supply. The formula gives zero ohms, and the datasheet maximum is above the supply. There is no resistor value that makes this reliable. A typical blue LED on a 3.3 V pin may glow dimly or not at all; one at the high end of the range will not light.
What to do instead
The usual fix is to drive the LED from a higher supply, such as the board’s 5 V rail, and switch it from the 3.3 V pin with a transistor. The earlier post on using a MOSFET as a switch covers that circuit. The resistor is then calculated for the 5 V supply, as in the table above.
More than one LED
In series: add the forward voltages
LEDs in series share one current, so one resistor serves the whole string, and the forward voltages add. Four red LEDs from 12 V at 20 mA need (12 − 4 × 1.9) / 0.020 = 220 Ω, which happens to be a standard value. At typical forward voltage that string runs at exactly 20 mA. If all four sit at the 2.5 V maximum, it runs at (12 − 10) / 220 = 9.1 mA. The more of the supply the LEDs use, the less voltage is left for the resistor to regulate with, and the more the current depends on the particular LEDs.
Two red LEDs in series on 5 V show the limit. At typical voltage they need 80 Ω for 15 mA, and an 82 Ω resistor gives 14.6 mA. At the maximum, two LEDs need 5.0 V between them, the entire supply, and the current calculation goes to zero: nothing would light. A series string should leave a healthy share of the supply, a volt or more, for the resistor.
In parallel: one resistor each
Sharing one resistor between LEDs in parallel looks economical and does not work well. The LEDs do not split the current evenly; whichever one has the lowest forward voltage takes the largest share, and because forward voltage falls as an LED warms up, it can take more and more. Each LED, or each series string, should have its own resistor. The table at 5 V above applies to each one separately.

Power in the resistor and the LED
P = I × V
The resistor turns its share of the voltage into heat. At 17.2 mA through 180 Ω, it dissipates I² × R = 53.4 mW. The red LED itself, at 1.9 V and 17.2 mA, dissipates 32.7 mW, well under the WP7113SRD/D’s 75 mW limit.
Common through-hole resistors are rated for a quarter watt, 250 mW, so indicator LEDs on 5 V are nowhere near the limit. Higher supply voltages change that. A red LED at 20 mA from 12 V needs (12 − 1.9) / 0.020 = 505 Ω, rounded up to 560 Ω, and the resistor then dissipates around 180 mW: inside a quarter-watt rating, but far enough along that a 1/8-watt part would be overloaded.
Check the current against the limits
The final check is always against the datasheet’s absolute maximums: 30 mA DC for the red and blue chips in the RGB part, 25 mA for its green chip. Designs aimed at 20 mA typical, with resistors rounded up, land below those limits even at the low end of the forward voltage range.
A short procedure
From datasheet to resistor
- Find the forward voltage at the intended current, both typical and maximum.
- Calculate R = (V_supply − V_F typical) / I.
- Round up to the next standard value.
- Recalculate the current at typical and maximum V_F, and decide whether the spread is acceptable.
- Check resistor power, I² × R, against its rating.
- If the supply is not comfortably above the maximum forward voltage, use a higher supply or a constant-current driver instead.
Sources
- Ohm’s Law, HyperPhysics (Georgia State University): https://hyperphysics.gsu.edu/hbase/electric/ohmlaw.html
- Kingbright WP154A4SUREQBFZGW datasheet (RGB 5 mm LED), via University of Pennsylvania: https://www.engineering.upenn.edu/~belab/equipment/electrical/RGB_LED.pdf
- Kingbright WP7113SRD/D datasheet (red 5 mm LED), via Milwaukee School of Engineering: https://faculty-web.msoe.edu/johnsontimoj/CE3101/files3101/red_led_spec.pdf
