LED Current-Limiting Resistor Calculation

How to calculate a current-limiting resistor for any LED. Step-by-step: supply voltage, forward voltage, target current, E-series rounding, and GPIO limits.

ZERO UPLOAD · ALL LOCAL
  1. Enter any two values: Voltage, Current, Resistance, or Power.
  2. The remaining two fields calculate instantly.
  3. Tap Copy next to any field to grab its value.

Pre-filled for this page

The Voltage and Current fields below are pre-filled to 3.2 V and 0.015 A, the worked example this page walks through, with the other two values calculated automatically.

Voltage V
Current A
Resistance Ω
Power W

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.

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.

Sources
  1. 1.

    Pololu, "Simple LED circuit," pololu.com, November 2010. https://www.pololu.com/blog/6/simple-led-circuit

  2. 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. 3.

    "Light-emitting diode," Wikipedia, accessed June 2026. https://en.wikipedia.org/wiki/Light-emitting_diode

  4. 4.

    Arduino, "Arduino Pin Current Limitations," playground.arduino.cc, accessed June 2026. https://playground.arduino.cc/Main/ArduinoPinCurrentLimitations/

  5. 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

FAQ