LED resistor calculator for Arduino and ESP32 pins
Pick your board and the color of your LED. Get the resistor from your kit, the current it really gives and the color bands to look for.
The short answer
To light an LED from an Arduino or ESP32 pin, put one resistor in series with it. Its value is the pin voltage minus the forward voltage of the LED, divided by the current you want. A red LED at 10 mA on a 5 V Uno needs 300 Ω, so use 330 Ω, the next kit value up.
Find the resistor for your LED
Pick your board and the color of the LED. The answer updates as you go.
Sets the voltage of the pin and its current limit.
Fills in a typical forward voltage for that color.
From the LED's datasheet, if you have it.
10 mA is a good start.
Use this resistor
330 ohms
Bands: Orange, Orange, Brown, Gold. Real current: 9.09 mA.
The exact answer is 300 Ω. Kits do not have that value, so this is the next one up. Rounding up keeps the current at or below what you asked for.
- Exact value
- 300 Ω
- Real current
- 9.09 mAYou asked for 10 mA
- If the LED is 100 mV off
- 8.79 mA to 9.39 mA
- Heat in the resistor
- 27.3 mWA standard 1/4 W resistor is fine
Wire it in one line: board pin, then the 330 Ω resistor, then the long leg of the LED. The short leg goes to GND.
One ATmega328P pin is specified for 20 mA in normal use. 40 mA is the absolute maximum: above it the chip can be damaged.
Assumes an Uno R3 or a clone with the ATmega328P chip running at 5 V. The Uno R4 uses a different chip, so these pin limits do not apply to it.
Where these limits come from
Microchip ATmega48A/PA/88A/PA/168A/PA/328/P data sheet DS40002061B, section 30.2, Table 30-1, notes 3 and 4 (test condition 20 mA at 5 V).
Microchip ATmega48A/PA/88A/PA/168A/PA/328/P data sheet DS40002061B, section 29.1 Absolute Maximum Ratings (DC current per I/O pin).
Build it
You have the resistor. Now put the LED to work: the AI Builder opens the editor with a traffic light on pins 11, 12 and 13. Each of its three LEDs needs a resistor like this one. It plans the project for an Arduino Uno, and every block stays yours to change.
It speaks board, not volts
Choose an Uno, Nano, Mega or ESP32 and the tool fills in the pin voltage and checks your current against the pin limit of that chip. The limits are read from the datasheet of the chip maker, and the tool says which board it assumes.
Rounded up, never down
A kit holds standard values, not every value. The tool always picks the next standard value above the exact answer, so the LED and the pin never carry more current than you asked for. Then it shows the current that resistor really gives.
Bands you can match
The answer is drawn as a resistor with its color bands, and the colors are written out in words too. Hold the part from your kit next to the drawing before you push it into the breadboard.
How it is worked out
The whole calculation is one line, Ohm's law across the resistor:
R = (V pin - V forward) / I
- V pin is the voltage of the pin when it is on: 5 V on an Uno, Nano or Mega, 3.3 V on an ESP32.
- V forward is what the LED takes for itself while it is lit: about 2 V for red, about 3 V for blue and white.
- I is the current you want, in amps. 10 mA is 0.01 A.
Worked example: a red LED on an Uno at 10 mA. 5 V minus 2 V leaves 3 V for the resistor. 3 V divided by 0.01 A is 300 Ω. The next kit value up is 330 Ω, and 3 V divided by 330 Ω is 9.09 mA.
What the tool assumes
- One LED on one pin, with its own resistor. Two LEDs need two resistors.
- The forward voltage is a typical figure for the color. Real LEDs differ, so the tool also shows the current if yours is 0.1 V off. If you have the datasheet of your LED, type its number in.
- Kit values are the E12 series: 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68 and 82, times a power of ten. The bands shown are for a four-band, 5 percent resistor.
- Pin limits come from the datasheet of the chip maker: the ATmega328P for the Uno and the classic Nano, the ATmega2560 for the Mega, and the ESP32 series datasheet. A clone with the same chip behaves the same. The Uno R4 and the 3.3 V Nano variants use other chips: pick the option that matches your board, or type the voltage.
- The heat in the resistor is the current squared times the resistance. A standard quarter-watt resistor is treated as good for half its rating, so it stays cool.
Need more depth? The full LED resistor calculator from InteRFace R&D adds LEDs in series, finer resistor series and surface-mount package sizes. It opens in a new tab.
From the number to a lit LED
The long leg of the LED goes toward the pin, through the resistor. The short leg goes to GND. It does not matter which side of the LED the resistor sits on, as long as it is in the same line. The LED wiring guide shows the breadboard, and the blink an LED tutorial makes it flash with four blocks.
You can try the logic with no parts at all in the Arduino simulator in the browser. It runs your blocks and shows every pin switch on and off. It does not model current, so it cannot tell you that a resistor is missing or too small. That is what this page is for.
Not sure the resistor in your hand is the right one? Read its bands with the resistor color code calculator. To read a sensor or a battery on an analog pin, use the voltage divider calculator.
See a project run first
Watch an LED project run in the editor before you pick up a resistor. The demo needs no account. It shows the logic only, not current, so the resistor still counts on a real board.
Open the live demoMore calculators and guides
- Resistor color code calculator →Check the bands of the resistor you picked.
- Voltage divider calculator →Two resistors for an analog pin.
- All calculators →
- LED wiring guide →Which leg goes where, and the Standard LED block.
- Blink an LED tutorial →The first project, step by step.
- ESP32 Wi-Fi LED tutorial →Switch an LED from your phone.
Quick answers
What resistor do I need for an LED on an Arduino Uno?
For a red LED on a 5 V Arduino Uno, 330 Ω gives 9.09 mA and 220 Ω gives 13.6 mA. Both are bright, and both are well inside what one pin is specified for. Blue and white LEDs have a higher forward voltage, so 220 Ω gives them about 8.64 mA.
What resistor do I need for an LED on an ESP32?
An ESP32 pin is 3.3 V, so less voltage is left for the resistor. A red LED at 10 mA needs 130 Ω exactly, and the next kit value up is 150 Ω. A blue or white LED needs about 3.1 V for itself, which leaves almost nothing for a resistor: from a 3.3 V pin it will be dim and uneven.
Why round the resistor up and not down?
A larger resistor lets less current through. Rounding up means the LED and the pin carry a little less than you asked for, never more. Rounding down would push the current above your target, and on a pin near its limit that matters. The LED is only slightly dimmer.
Can I connect an LED to a pin without a resistor?
No. Without a resistor, nothing limits the current except the pin and the LED themselves, and both can be damaged. The small LED on pin 13 of an Uno is no exception: the board already carries a resistor for it.
How much current can one Arduino pin give?
One pin of the ATmega328P chip in an Uno or a classic Nano is specified for 20 mA in normal use, and 40 mA is the absolute maximum, where damage can start. Both figures are from the datasheet of the chip maker. An indicator LED needs far less: 5 mA to 10 mA is plenty.
Do I need a different resistor for each LED color?
Often, yes. Red, yellow and green LEDs take about 2 V, while blue and white take about 3 V. On a 5 V pin the same resistor gives a blue LED roughly two thirds of the current of a red one. Pick the color in the calculator and it fills in a typical forward voltage.
Last updated 2026-12-02.