ESP32 Calcs

LED Resistor Calculator — With E24 Values and Power Rating

Who this is for: For anyone blinking an LED from a microcontroller: the two things that go wrong are picking a resistor you can't buy and forgetting the resistor will dissipate real heat.

Series resistor for one or more LEDs: enter supply, forward voltage and target current to get the exact resistance, the nearest E24 value to buy, actual current and the power rating you need.

Quick answer: R = (supply voltage − LED forward voltage × LED count) ÷ target current in amps. A red LED (2.0 V, 10 mA) on a 3.3 V GPIO: R = (3.3 − 2.0) ÷ 0.01 = 130 Ω — which happens to be a standard E24 value. The calculator also rounds to the nearest E24 resistor above the exact value (safer: slightly less current), returns the actual current with that resistor, and tells you the power rating to buy (2× the dissipation).

ESP32 GPIO outputs 3.3 V · 5 V rail for longer strings

From the LED datasheet; 2.0 red · 3.2 blue/white

10 mA is bright for indicators; 20 mA is the classic max

Vf adds up — 2 × 2.0 V won't run from 3.3 V

Presets:
Resistor (calculated)
130 Ω
Use the E24 value
130 Ω
Actual LED current
10 mA
Resistor dissipation
13 mW
QuantityValueWhy it matters
Voltage across resistor1.3 VSupply minus the LED drop — sets the current with R
Recommended power rating125 mW2× headroom so the resistor runs cool
LED string dissipation20 mWWhat the LEDs themselves burn
Driving an LED directly from an ESP32 GPIO? Keep the current at 10–12 mA — the datasheet-safe default — even though the absolute pin maximum is 40 mA. Anything brighter (or more than one LED) should switch through a transistor or MOSFET, with the GPIO driving only the gate/base. Pins GPIO34–39 can't drive an LED at all (input-only), and GPIO6–11 are reserved for flash.
Core facts
FormulaR = (Vs − Vf × count) ÷ I
E24 roundingnearest standard value from above
Power rulerating ≥ 2 × (Vs − Vf)² ÷ R
ESP32 GPIO10–12 mA safe · 40 mA absolute max
Typical Vfred 2.0 V · yellow 2.1 V · green 2.2 V · blue/white 3.2 V

How to calculate an LED series resistor

The LED series resistor does one job: drop the difference between the supply voltage and the LED's forward voltage, at a current the LED can survive. The formula is Ohm's law with one twist — an LED is not a resistor, it clamps its own voltage (Vf) once it conducts, so the resistor sees the leftover voltage entirely: R = (Vs − Vf×count) ÷ I.

The calculator adds the three practical steps that the bare formula skips. First, E24 rounding: the exact 133 Ω you computed doesn't exist in shops; the tool picks the nearest standard value from above (limiting current slightly below target, which is the safe direction for the LED). Second, real current: with the standard resistor the actual current differs from your target, and for indicator LEDs that difference is exactly what determines brightness. Third, power: the resistor burns (Vs − Vf)² ÷ R watts; anything over a quarter watt needs a physically bigger resistor, and running at 2× headroom keeps it cool.

There are also cases where the honest answer is "don't". If the supply is 3.3 V and the LED is a blue/white one (Vf ≈ 3.2 V), the leftover voltage is only 0.1 V — the resistor becomes ≈ 10 Ω and the actual current depends on how closely the LED's Vf matches the datasheet, which it rarely does. The tool still computes it, but the note warns you: for Vf close to the supply, use a constant-current driver or accept unstable brightness.

Common uses

  • Picking the resistor for a status LED on an ESP32 GPIO (3.3 V, 10 mA)
  • Driving an IR LED for a remote or sensor at exactly 20 mA
  • Sizing resistors for a 12 V LED indicator panel (long strings in series)
  • Checking how hot a 20 mA white LED's resistor will get before ordering
  • Choosing between 10 mA (safe from any GPIO) and a transistor-switched 60 mA LED

Current limits when the LED sits on a GPIO

An ESP32 GPIO is comfortable at 10–12 mA and tolerates up to 40 mA absolute maximum — but two LEDs at 20 mA each already exceeds what you should pull from one pin, and GPIO34–39 (classic chip) can't drive an LED at all. For anything above ~12 mA, switch through a transistor or MOSFET: the GPIO drives the gate, the transistor carries the current. Connect the resistor on the LED side as usual, and never put an LED between a GPIO and ground without a resistor — that's how pins die.

Series and parallel LED rules

Series: forward voltages add (2 × 2.0 V = 4.0 V — already more than a 3.3 V GPIO can supply; use 5 V or 12 V rails for strings), current stays the same, one resistor for the whole string. Parallel: never share one resistor across parallel LEDs — Vf differs per LED, so one LED hogs the current. Give each LED its own resistor, or wire them in series when the supply allows.

Frequently Asked Questions

How do I calculate the resistor for an LED?
Subtract the LED's forward voltage from the supply voltage, then divide by your target current in amps: R = (Vs − Vf) ÷ I. For a red LED (2.0 V) on 5 V at 20 mA: (5 − 2.0) ÷ 0.02 = 150 Ω. The result rounds up to the nearest E24 standard value so you can actually buy it.
Can I drive an LED directly from an ESP32 GPIO?
Yes, within limits: keep the total under 10–12 mA per pin (the absolute maximum is 40 mA but you should never design near it). One standard indicator LED at 10 mA is fine with the right resistor. Brighter loads, multiple LEDs, or anything over ~12 mA should use a transistor or MOSFET as the switch, with the GPIO controlling it.
Why can't I run a blue LED at full brightness from 3.3 V?
Blue and white LEDs have a forward voltage around 3.2 V — very close to the 3.3 V supply. That leaves only ~0.1 V for the resistor, so tiny manufacturing differences in the LED's Vf swing the current wildly, and brightness becomes unpredictable. It works for indicator use, but for consistent brightness use a 5 V supply (with a transistor switch from the GPIO) or a constant-current LED driver.
Does the resistor wattage actually matter?
Yes — it's the part people skip. The resistor dissipates (Vs − Vf)² ÷ R watts. A 10 mA indicator LED: ~13 mW, any resistor survives. A 60 mA LED string with 7 V across the resistor: 0.42 W, and a standard 1/4 W resistor will run hot and drift. The calculator returns the recommended rating (2× dissipation, rounded to a standard size) so you buy the right physical part once.
Should LEDs go in series or parallel?
Series when the supply voltage allows: the same current flows through all of them and one resistor protects the string — forward voltages add (2 × 2.0 V red LEDs need at least ~5 V supply). Parallel needs one resistor per LED, always — sharing a single resistor across parallel LEDs lets the lowest-Vf LED take most of the current and run away.
Which resistor value should I buy if the exact value doesn't exist?
The nearest E24 value above the calculated one — slightly more resistance means slightly less current, which is the safe direction for LED lifetime and GPIO current limits. E24 covers 5% tolerance parts like 130, 150, 220 and 330 Ω; the calculator picks from the same series shops stock.

More guides

ESP32 Projects for Beginners

10 starter projects in the right order: from blink to Wi-Fi to your first cloud dashboard, with the hardware list and the wiring traps each one teaches.

ESP32 Deep Sleep & Battery Power Guide

How to actually get weeks-to-months battery life: deep sleep modes, wake sources, the dev-board overhead leak, and a measurement recipe to find your real sleep current.

ESP32 vs Arduino vs Raspberry Pi Pico

Which board should you buy in 2026? Wi-Fi and Bluetooth vs simplicity vs RP2040 — a decision table by project type, with the ESP32's edge for connected and AI hardware.

More Electronics calculators

Battery Life Calculator

Battery runtime for microcontroller projects: enter capacity, active current, duty cycle and sleep current to get real-world battery life in hours and days — the way it actually behaves on an ESP32-class board.

Voltage Divider Calculator

Two-resistor voltage divider: output voltage, divider current and dissipation — plus the R2 value that hits a target voltage, and the ESP32 ADC limits that decide whether your reading will actually be stable.

PCB Trace Width Calculator

IPC-2221 trace width for your current, temperature rise and copper weight — external or internal layer — plus resistance and voltage drop when you enter the trace length.

LED Strip Power Calculator

Power supply sizing for LED strips: enter length and W/m to get total watts, total amps, the PSU wattage to buy with headroom, and how many power injection points the strip needs.