HomeEngineering & Automotive › LED Resistor Calculator

LED Resistor Calculator

Computes the current-limiting series resistor for one or more LEDs in series from the supply voltage, LED forward voltage and desired current, then picks the nearest E12 and E24 preferred values, a safe (rounded-up) E24 value and the resistor power rating.

When to use

You are wiring an LED (or a string of LEDs in series) to a DC supply and need the resistor value, a standard part value and its wattage.

Do not use when: LEDs are in parallel (each branch needs its own resistor), you drive high-power LEDs with a constant-current driver, or you only need Ohm's law (use ohms-law).

Formula

resistor_ohm = (supply_voltage_v − leds_in_series × led_forward_voltage_v) / (led_current_ma / 1000); resistor_power_w = (supply_voltage_v − leds_in_series × led_forward_voltage_v) × led_current_ma / 1000; rating ≥ 2 × resistor_power_w

Standard values follow IEC 60063 E12/E24 series. The 2× power margin is the usual derating rule so the resistor runs cool; LED forward voltage varies ±10 % between parts and with temperature, so the actual current differs slightly.

Inputs

ParameterTypeUnitRequiredDescription
supply_voltage_vnumberVyesDC supply voltage in volts (e.g. 5, 9, 12, 24). Range: > 0, ≤ 1000
led_forward_voltage_vnumberVdefault 2Forward voltage drop of one LED at the design current: red/yellow ≈ 1.8–2.2 V, green ≈ 2.0–3.2 V, blue/white ≈ 3.0–3.6 V. Range: > 0, ≤ 50
led_current_manumbermAdefault 20Desired forward current in milliamperes; 20 mA is typical for 5 mm indicator LEDs. Range: > 0, ≤ 5000
leds_in_seriesintegerdefault 1Number of LEDs connected in series in one string. Range: ≥ 1, ≤ 100

Outputs

OutputTypeUnitDescription
total_led_voltage_vnumberVleds_in_series × led_forward_voltage_v.
resistor_voltage_vnumberVsupply_voltage_v − total_led_voltage_v.
resistor_ohmnumberΩR = resistor_voltage_v / led_current_a.
nearest_e12_ohmnumberΩClosest value in the E12 (10 %) preferred-number series.
nearest_e24_ohmnumberΩClosest value in the E24 (5 %) preferred-number series.
recommended_resistor_ohmnumberΩSmallest E24 value at or above the exact value, so the LED current does not exceed the target.
current_with_recommended_manumbermAresistor_voltage_v / recommended_resistor_ohm × 1000.
resistor_power_wnumberWPower dissipated in the resistor: resistor_voltage_v × led_current_a.
recommended_power_rating_wnumberWSmallest standard rating (1/8, 1/4, 1/2, 1, 2, 3, 5 W …) at or above twice the dissipated power.

Example

12 V supply, 2 V LED, 20 mA: {"supply_voltage_v":12,"led_forward_voltage_v":2,"led_current_ma":20}{"total_led_voltage_v":2,"resistor_voltage_v":10,"resistor_ohm":500,"nearest_e12_ohm":470,"nearest_e24_ohm":510,"recommended_resistor_ohm":510,"current_with_recommended_ma":19.61,"resistor_power_w":0.2,"recommended_power_rating_w":0.5}

Three 3.2 V white LEDs in series on 12 V at 20 mA: {"supply_voltage_v":12,"led_forward_voltage_v":3.2,"led_current_ma":20,"leds_in_series":3}{"total_led_voltage_v":9.6,"resistor_ohm":120,"nearest_e12_ohm":120,"recommended_resistor_ohm":120,"current_with_recommended_ma":20,"resistor_power_w":0.048,"recommended_power_rating_w":0.125}

GET https://tttkmbb.com/api/v1/calculate/led-resistor?supply_voltage_v=12&led_forward_voltage_v=2&led_current_ma=20

Machine access

Sources

FAQ

Why round the resistor up rather than to the nearest value?

A larger resistor lowers the current slightly (dimmer but safe); a smaller one raises it above the LED rating. The nearest values are reported for reference, the recommended value is the next E24 value at or above the exact result.

What if the supply voltage barely exceeds the LED voltage?

The resistor becomes very small and the current very sensitive to voltage tolerance. Keep at least 2–3 V across the resistor, or use a constant-current driver.

How many LEDs can I put in series?

Their forward voltages must sum to less than the supply voltage; the calculator returns an error otherwise.

Related calculators