Choosing the Right LED Current-Limiting Resistor
LED brightness is controlled by current, not voltage.1
When you connect an LED directly to a 5V supply without a series resistor, the diode conducts heavily, heats up, and fails within seconds. A current-limiting resistor prevents this by restricting current to the safe 10–20 mA range, protecting both the LED and the GPIO or driver output that switches it. Getting this wrong ends with either a dim, dying LED (too much resistance) or a burned LED and potentially a damaged microcontroller output pin (too little). The calculation is straightforward: subtract the LED's forward voltage from the supply, then divide by the desired current.
The formula and what each variable means
R = (Vs − Vf) / If, where Vs is the supply voltage, Vf is the LED forward voltage, and If is the target forward current. For a standard red LED at 5V with Vf = 1.8V and target If = 15 mA: R = (5 − 1.8) / 0.015 = 213.3Ω. Round up to the next E24 preferred value, 220Ω. The forward voltage varies by LED colour: red and yellow are typically 1.8–2.1V, green is 2.0–2.2V, blue and white are 3.0–3.4V.1 Use the datasheet value when precision matters; 2.0V is a safe estimate when the datasheet is unavailable.
Starting with forward voltage and target current
The formula only works when Vs, Vf, and If are in compatible units. Convert milliamps to amperes before calculating, then round up to the nearest standard resistor value. Starting with the correct forward voltage for your specific LED colour is critical because using a generic 2V estimate for a blue LED with an actual Vf of 3.2V would give you a resistor value nearly twice as large as needed, producing a dim result.
A quick sanity check after rounding is to recompute the current with the chosen resistor and confirm it lands inside the 10–20 mA window, because rounding can move a 15 mA target toward either edge. If your supply is unregulated, use its highest expected voltage in the formula rather than the nominal, so the worst-case current still stays safe as the supply sags under load. CapyToolkit's calculator runs this check automatically across several supply and Vf combinations, which is faster than repeating the arithmetic by hand each time the circuit changes.
Step-by-step resistor selection
First, identify your supply voltage Vs (3.3V, 5V, 9V, or 12V are most common). Second, find the LED's forward voltage Vf,check the datasheet or use 2.0V as an estimate. Third, choose your target current If,10 mA for dim indicators, 15–20 mA for bright indicators, less than 5 mA for low-power designs.
Rounding up to the nearest safe E24 value
Fourth, calculate R = (Vs − Vf) / If and round up to the nearest E24 value. Fifth, verify power dissipation: P = If² × R; ensure it is below half the resistor's wattage rating for a 2× safety margin.2 Rounding up rather than down is the conservative choice because it guarantees the current stays at or below the target value, protecting the LED from overcurrent even when the resistor measures at the low end of its tolerance band.
Common mistakes and practical tips
Forgetting to subtract Vf is the most common error: using R = Vs / If instead of (Vs − Vf) / If gives a resistor 30–60% too large, resulting in a dim LED. Using If = 20 mA as the target without checking the datasheet's absolute maximum current rating leads to LED overheating when resistors are at the low end of their tolerance.
Avoiding shared resistors in parallel LEDs
Paralleling LEDs on one resistor causes unequal current sharing since each LED's Vf differs slightly; use one resistor per LED.3 Connecting the resistor on the cathode side rather than the anode works electrically, but placing it on the anode simplifies troubleshooting. When one LED in a parallel pair fails open, the remaining LED suddenly receives double the intended current through the shared resistor, which can accelerate its failure and create a cascade effect that burns out the entire string within minutes.
A current mirror is the proper fix when a single shared sense element is unavoidable, because it forces equal current through each LED regardless of its individual Vf spread. For a simple hobby build the per-LED resistor is the cheaper and more robust answer, since each branch becomes independent and a failure in one LED cannot disturb its neighbours. When the array runs from a constant-current driver instead of a resistor, the shared-resistor problem disappears entirely, because the driver holds current steady across the whole string without depending on each LED's forward voltage.
Multi-colour LED arrays and per-LED resistors
Connecting LEDs of different colours to a single shared resistor produces unequal brightness because each colour has a different forward voltage. A red LED (Vf ≈ 1.8V) and a blue LED (Vf ≈ 3.2V) in parallel on one 220Ω resistor at 5V draw unequal current: the red LED carries the larger share because its lower Vf allows more conduction through that branch, overdriving it while underdriving the blue.
Use one resistor per LED in any multi-colour array. Calculate R = (Vs − Vf) / If for each LED's specific forward voltage independently.3 For 5V with red LEDs at 10 mA: R = (5 − 1.8) / 0.010 = 320Ω, round to 330Ω. For blue LEDs at 10 mA on the same 5V supply: R = (5 − 3.2) / 0.010 = 180Ω. Per-LED resistors keep each channel at the target current and produce consistent relative brightness across colours.
Forward voltage variation and temperature effects
LED forward voltage Vf decreases by approximately 2 mV per degree Celsius increase in junction temperature. At 25°C a red LED shows Vf = 1.8V; at 85°C the same LED drops to approximately 1.68V. This 120 mV reduction increases current through a fixed resistor: for a 220Ω resistor at 5V, the current at 85°C rises from 14.5 mA to 15.1 mA, a 4% increase.
For most indicator LEDs this variation is inconsequential: a 4% current change produces no visible brightness difference and stays within the safe operating range. In precision colour-matched LED displays or high-current LEDs running continuously, the Vf shift and resulting current increase can accelerate lumen depreciation over time. Sizing the resistor 10–15% larger than the room-temperature calculation provides a current safety margin that remains adequate at elevated operating temperatures, once you pick the right LED series resistor from the standard values.
When to use this
Use this guide whenever you are connecting an LED to a microcontroller output, a 5V supply, or a battery-powered circuit. Recalculate any time you change supply voltage, switch LED colour (forward voltage differs by colour), or add LEDs to a circuit that was originally sized for a different configuration.
Examples
Red LED on Arduino 5V pin
Supply: 5V, LED Vf: 1.8V, Target If: 15 mA R = (5 − 1.8) / 0.015 = 213Ω → round up to 220Ω Power: 0.015² × 220 = 49.5 mW → ¼W resistor fine
220Ω resistor, 15 mA, LED fully lit without risk to the GPIO pin.
Blue LED on 3.3V GPIO
Supply: 3.3V, LED Vf: 3.2V (blue), Target If: 10 mA R = (3.3 − 3.2) / 0.010 = 10Ω
A 10Ω resistor with 3.3V and a 3.2V blue LED barely limits current. Switch to a 5V supply for adequate headroom or accept dim operation.
Blue LEDs have very small headroom on 3.3V. Consider LEDs with lower Vf, or use a 5V supply.
- 1.
"LED Resistor and Choosing the Correct Resistor for LED Circuits," Electronics Tutorials, accessed June 2026. https://www.electronics-tutorials.ws/resistor/led-resistor.html
- 2.
"Resistor Power," Electronics Tutorials, accessed June 2026. https://www.electronics-tutorials.ws/resistor/res_8.html
- 3.
"Why exactly can't a single resistor be used for many parallel LEDs?," Electronics Stack Exchange, accessed June 2026. https://electronics.stackexchange.com/questions/22291/why-exactly-cant-a-single-resistor-be-used-for-many-parallel-leds