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.
Run this check yourself in the Resistor Color Code Calculator.
Open in the tool →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, a configuration that trades component count for exact per-LED current matching.4
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.5 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
- 4.
Texas Instruments, "LED-Driver Considerations," SLYT084, ti.com, accessed June 2026. https://www.ti.com/lit/pdf/slyt084
- 5.
Texas Instruments, "LED Temperature Protection by Vf Monitoring," SLVAEB5, ti.com, accessed June 2026. https://www.ti.com/lit/slvaeb5
LED Current-Limiting Resistor Calculation
LED current-limiting resistors save LEDs from destruction. Without a series resistor, an LED connected directly to a supply draws uncontrolled current and destroys its junction in seconds. Applying I = V/R solves the sizing problem: subtract the LED's forward voltage from the supply to find the voltage the resistor must drop, then divide by the target current to find the required resistance. Two inputs determine the answer, and both can trip up beginners. By color, forward voltage varies from roughly 1.8 V for red LEDs to 3.2 V for blue and white.1 On top of that, GPIO current limits apply: most microcontroller output pins source no more than 40 mA, so the resistor must keep the total loop current within that bound regardless of supply voltage.
Run this check yourself in the Resistor Color Code Calculator.
Open in the tool →Calculating the resistor value step by step
Sizing an LED resistor requires three pieces of information: the supply voltage, the LED's forward voltage at the intended current, and the target operating current that produces the brightness you need. Subtract the forward voltage from the supply to find the voltage the resistor must drop, because the LED junction itself consumes a fixed portion of the available voltage regardless of the current flowing through it. Divide that difference by the target current to get the required resistance, and always round up to the next standard E-series value to keep the actual current at or below your target.
For a 5 V supply driving a standard red LED with a 1.8 V forward voltage at 15 mA: R = (5.0 - 1.8) / 0.015 = 213 Ω. The nearest E24 standard resistor above that value is 220 Ω, which limits current to about 14.5 mA and keeps the LED operating comfortably within its safe range while still producing visible brightness for indicator or status-light purposes.
Rounding up to the nearest standard value
Choosing a value above the calculated result rather than below keeps the current slightly under target. Rounding up is the safe convention. If you round down instead, the current exceeds the target: a 200 Ω resistor in the same circuit would pass 16 mA instead of 15 mA, a 7 percent overcurrent that shortens the LED's life. For LEDs with a tight maximum current rating, such as 20 mA standard types, always round up and verify the actual current stays at least 10 percent below the maximum to provide a reliability margin, and the right LED current-limiting resistor takes only the supply voltage and target current.
Forward voltage by LED color and its effect on resistor choice
Forward voltage is not a single number but a range that varies by LED color, junction chemistry, and operating temperature, so you must look up the specific value for the part you are using rather than relying on a generic assumption. Red and yellow types have the lowest forward voltages, typically 1.8 to 2.2 V, because their aluminium gallium arsenide junctions require less energy to emit photons in the red part of the spectrum.2 For green LEDs, the range moves to 2.0 to 2.5 V.
Blue and white LEDs, which use a different junction chemistry (indium gallium nitride), require 3.0 to 3.4 V, and this higher forward voltage has direct consequences for resistor selection when your supply voltage is only 3.3 V.3 The narrower headroom at higher forward voltages demands a closer look at the resistor calculation, because even small variations in junction voltage or supply voltage represent a larger fraction of the small voltage the resistor must drop.
At a 3.3 V supply, a blue LED with a 3.2 V forward voltage leaves only 0.1 V for the resistor to drop. At 15 mA that demands a 6.7 Ω resistor, which is not a standard E-series value and provides almost no current regulation. Blue and white LEDs are better driven from 5 V or from a constant-current driver when the supply and junction voltage are too close for stable resistor limiting.
For any LED type, check the specific part datasheet rather than relying on a color-standard typical value. High-efficiency LEDs can run forward voltages 100 to 200 mV above the nominal for older standard types. Using the maximum Vf from the datasheet when calculating the resistor ensures the current stays within the rated maximum when individual LEDs arrive at the high end of their production tolerance range.
Also note the test current at which Vf is specified, since datasheets typically measure it at 20 mA and your operating current may shift the actual junction voltage down by 50 to 100 mV. This mild forward-voltage reduction at operating currents below the datasheet test point works in your favor slightly, but designing around the maximum Vf keeps your worst-case current within the rated limit regardless of where in the production tolerance range the specific part falls.
Calculating resistor power dissipation for LED circuits
The resistor in an LED circuit dissipates P = I²R or P = V_resistor × I. For a typical red LED circuit with a 220 Ω resistor at 14.5 mA, the dissipation is 0.0145² × 220 = 46 mW, well within a quarter-watt rating. However, at higher currents or larger resistors, the dissipation adds up: a 100 Ω resistor at 30 mA dissipates 90 mW, still safe for quarter-watt but getting close to the 50 percent derating threshold. Always verify the resistor wattage, especially when driving LEDs at or above 20 mA with resistors above 150 Ω, because the dissipation scales with the square of the current.
GPIO current limits and multiple LED constraints
GPIO current limits are easy to overlook. Microcontroller GPIO pins carry two separate constraints that both affect LED resistor sizing. The per-pin maximum is typically 25 mA continuous on an Arduino Uno I/O pin, with a 40 mA absolute maximum. Across all active outputs simultaneously, the total current through the ATmega328P VCC and GND pins is rated at 200 mA, with per-port subgroup limits of 150 mA for source current and 100 mA for sink current.4
Driving three LEDs at 15 mA each from separate GPIO pins draws 45 mA from that supply, well under the aggregate rating but worth tracking as you add more loads, and the insidious part is that the circuit appears to work fine during brief testing but gradually overheats the microcontroller's internal voltage regulator or power distribution network if you approach the limits, leading to intermittent resets or shortened chip lifespan that is difficult to diagnose without a current meter on the supply rail.
Moving LED current off the GPIO supply
When multiple LEDs share a GPIO supply, sum the individual currents and confirm the total stays within the aggregate limit. Beyond three or four LEDs, use a transistor driver or LED driver IC to keep LED current off the microcontroller GPIO supply entirely and avoid the aggregate limit. A single 2N2222 NPN transistor needs a base current of about 10 to 20 mA to fully saturate and switch up to 200 mA of LED current from the main 5 V rail (a forced beta of 10 to 20 for hard saturation), so a logic-level MOSFET or a Darlington pair such as a ULN2003 is usually a better choice when the GPIO pin can only source a few milliamps.5
This approach scales to dozens of LEDs with a transistor per channel, and the BOM cost per channel is under 10 cents. Each channel operates independently, so a failure in one LED or transistor does not affect the others, which matters in arrays where a single open LED would otherwise disable a whole string.
When to use this
Use this guide when designing an LED circuit from any digital supply: Arduino GPIO, Raspberry Pi, discrete transistor outputs, or a bench power supply. Reference it when confirming a resistor value before building, verifying an existing circuit's safety margin, or diagnosing an LED that is too dim or has failed after first power-on.
Examples
5V supply, red LED (Vf = 1.8V) at 15mA
R = (5.0 - 1.8) / 0.015 = 213 Ω. Nearest E24 value above: 220 Ω. This gives about 14.5 mA, within the safe 10-20 mA range for standard through-hole red LEDs.
3.3V supply, blue LED (Vf = 3.2V) at 10mA
R = (3.3 - 3.2) / 0.010 = 10 Ω. Only 0.1 V of headroom makes resistor-limiting unreliable. Use a 5 V supply or a constant-current LED driver instead for blue and white LEDs on 3.3 V rails.
Arduino 5V GPIO, white LED (Vf = 3.1V) at 20mA, with GPIO aggregate check
R = (5.0 - 3.1) / 0.020 = 95 Ω, nearest E24: 100 Ω. Also confirm the total current from all simultaneously active GPIO pins stays under the Uno's 40 mA aggregate supply limit.
- 1.
Pololu, "Simple LED circuit," pololu.com, November 2010. https://www.pololu.com/blog/6/simple-led-circuit
- 2.
Texas Instruments, "LED Forward Voltage Considerations," ti.com, accessed June 2026. https://www.ti.com/document-viewer/lit/html/SSZT675/GUID-66ACCEE0-163C-4A9E-9D8F-8E5B1D122E19
- 3.
"Light-emitting diode," Wikipedia, accessed June 2026. https://en.wikipedia.org/wiki/Light-emitting_diode
- 4.
Arduino, "Arduino Pin Current Limitations," playground.arduino.cc, accessed June 2026. https://playground.arduino.cc/Main/ArduinoPinCurrentLimitations/
- 5.
Jack Creasey, "Simple LED driver, transistor and GPIO," Electrical Engineering Stack Exchange, 2019. https://electronics.stackexchange.com/questions/447905/simple-led-driver-transistor-and-gpio
Subtract the LED forward voltage from the supply voltage to find the voltage the resistor must drop. Divide by the target current in amps to get the resistance. For a 5 V supply, a 2.0 V red LED at 20 mA: R = (5.0 - 2.0) / 0.020 = 150 Ω. Choose the nearest E-series value at or above that result.
Red and yellow LEDs have forward voltages around 1.8 to 2.2 V. Green LEDs typically range from 2.0 to 2.5 V. Blue and white LEDs require 3.0 to 3.4 V due to their indium gallium nitride junction chemistry. High-brightness and specialty types vary; always check the specific part datasheet.
Yes, but add all the forward voltages together before calculating. For three red LEDs in series at 20 mA from a 12 V supply: total Vf = 3 × 1.9 = 5.7 V, so R = (12 - 5.7) / 0.020 = 315 Ω. Use a 330 Ω standard value. Match LED types within the string for consistent brightness.
Too large a resistor limits current below the target, making the LED dimmer than intended. Too small a resistor allows excess current, which raises junction temperature, shifts emission color, and shortens the LED lifetime. In extreme cases with a low-impedance supply, an under-sized resistor destroys the LED in seconds.
Yes. Enter the net voltage (supply voltage minus LED forward voltage) in the Voltage field and the target current in the Current field. The calculator solves R = V/I and displays the result in ohms. CapyToolkit also shows power dissipation, which confirms whether a quarter-watt or half-watt resistor is appropriate.