LED resistor calculator
Pick your board or battery and your LED color, and see which resistor keeps the LED safe, drawn with its color bands.
How it works
An LED is greedy. Give it a battery with nothing in the way and it gulps as much electricity as it can, gets too hot and burns out, sometimes in less than a second. A resistor is like pinching a straw: it lets only a safe sip through. To pick the right one, take the voltage of your battery or board, subtract the voltage the LED keeps for itself (about 2 volts for red, about 3 for blue and white), and divide what is left by the current you want. Then pick the next bigger resistor you actually have in your kit. Bigger is always the safe direction: the LED is just a little dimmer.
Worked examples
- Arduino 5 V, red LED, 15 mA: (5 - 2.0) / 0.015 = 200 -> use 220 ohm -> 13.6 mA, 0.04 W.
- Arduino 5 V, blue or white LED, 15 mA: (5 - 3.2) / 0.015 = 120 -> use 120 ohm -> 15 mA.
- 3.3 V pin, red LED, 10 mA: (3.3 - 2.0) / 0.010 = 130 -> use 150 ohm -> 8.7 mA.
- 9 V battery, two red LEDs in series, 15 mA: (9 - 4.0) / 0.015 = 333 -> use 390 ohm -> 12.8 mA, 0.06 W.
- 9 V battery, one blue LED, 20 mA: (9 - 3.2) / 0.020 = 290 -> use 330 ohm -> 17.6 mA, 0.10 W.
More free tools
- LED Resistor Calculator
- Resistor Color Code Decoder
- Arduino and Snap Circuits simulators
- Free Arduino blink lesson
- All free tools
Teachers: printable lesson plans, first session free. Arduino lesson plans | ESP32 lesson plans
Low-voltage battery and USB projects only. Never experiment with wall power.
Frequently asked questions
Why does an LED need a resistor?
An LED does not limit its own current. Once the voltage across it passes its forward voltage, the current climbs very fast, so without a resistor it can overheat and burn out, and it can also overload the pin driving it. The resistor sets a safe current.
What resistor do I need for an LED on a 5 V Arduino?
For a red, yellow or green LED, 220 ohms is the classic choice and anything from 220 to 330 ohms is safe. The math for a red LED at 15 mA is (5 - 2.0) / 0.015 = 200 ohms, and the next standard value up is 220.
What resistor do I need on a 3.3 V board such as an ESP32?
On an ESP32, for a red LED at 10 mA, (3.3 - 2.0) / 0.010 = 130 ohms, so use 150 ohms. The pins on a micro:bit or Raspberry Pi Pico supply less current, so choose 'Gentle' (5 mA) there: (3.3 - 2.0) / 0.005 = 260 ohms, so use 270 ohms. Blue and white LEDs need about 3.2 volts themselves, which leaves almost nothing to spare on a 3.3 V pin. The calculator then picks a larger resistor to be safe, so they look dim.
What happens if I use a bigger or smaller resistor than the calculator says?
Bigger is safe: the LED is dimmer. Smaller lets more current through: the LED is brighter, runs hotter and may not last. If you do not have the exact value, go up, not down.
Can several LEDs share one resistor?
In series, yes: the same current flows through all of them and their voltages add up, which this calculator handles. In parallel, give each LED its own resistor, because no two LEDs are identical and one would take more than its share.
Does the resistor go before or after the LED?
Either. In a single loop the same current flows through every part, so the order does not matter. The direction of the LED does matter: the long leg goes toward plus.