LED resistor calculator
Supply voltage, LED colour and current in — the standard resistor to buy and its power rating out.
Presets
Above a GPIO's comfortable limit. Keep LEDs on a microcontroller pin to about 8–15 mA (ESP32/Pico) or ≤ 20 mA (Uno). For more, switch the LED with a transistor.
How it works
The resistor drops whatever voltage the LED doesn't need, and that drop sets the current (Ohm's law):
R = (Vsupply − Vf) ÷ ILED P = (Vsupply − Vf) × IWe round up to the next E12 value (10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 × 10ⁿ), so the real current is a little lower than you asked for — never higher. The result shows that real current.
Caveats
- Forward voltage varies by maker and current; check the LED's datasheet if you need accuracy.
- On a 3.3 V pin, blue and white LEDs (≈3.1 V) leave almost no headroom — they'll be dim and uneven. Use a red/green LED, or drive them from 5 V through a transistor.
- ESP32 GPIOs are rated 40 mA absolute maximum, with about 20 mA recommended; the whole chip has a total limit too. Treat 8–15 mA per LED as comfortable.