LED Resistor Calculator Formula

Understand the math behind the led resistor calculator. Each variable explained with a worked example.

Formulas Used

Required Resistance

resistor_ohm = (supply_voltage - led_forward_voltage) / led_current_a

Resistor Power Dissipation

resistor_power_mw = (supply_voltage - led_forward_voltage) * led_current_a * 1000

Variables

VariableDescriptionDefault
supply_voltageSupply Voltage(V)5
led_forward_voltageLED Forward Voltage(V)2
led_current_maLED Current(mA)20
led_current_aDerived value= led_current_ma / 1000calculated

How It Works

How to Size a Resistor for an LED

An LED needs a series resistor to limit current.

Formula

R = (V_supply - V_led) / I_led

Where:

  • V_supply = Source voltage
  • V_led = LED forward voltage drop
  • I_led = Desired LED current (commonly 20 mA)
  • Power dissipated in the resistor is P = (V_supply - V_led) x I_led.

    Worked Example

    Drive a red LED (2.0 V forward) at 20 mA from a 5 V supply.

    supply_voltage = 5led_forward_voltage = 2led_current_ma = 20
    1. 01Voltage across resistor = 5 - 2.0 = 3.0 V
    2. 02Current in amps = 20 / 1000 = 0.02 A
    3. 03R = 3.0 / 0.02 = 150 ohms
    4. 04Power = 3.0 x 0.02 = 0.06 W = 60 mW

    Ready to run the numbers?

    Open LED Resistor Calculator