Skip to content
Electronics 14 min read

What Resistor for an LED on Arduino 5V and 3.3V?

Observation recorded
Red LED on a 5 V Arduino supply through a 150 ohm resistor with brown green brown bands, the schematic showing 3 V across the resistor and a current gauge at 20 mA

Every Arduino starter kit ships the same bag: a handful of 5 mm LEDs and a strip of 220 Ω resistors. On a 5 V Uno that pairing gives a red LED about 14 mA, which is right. Move the same LED and resistor to a 3.3 V ESP32 and the red LED drops to about 6 mA. Swap in a white LED and it gets about 1.5 mA, a dim glow that makes people think the board is faulty. The resistor did not change. The headroom did.

This post gives you the resistor for every common LED colour on 5 V and 3.3 V pins, shows the two calculations behind the table, and explains why a white LED on 3.3 V has no good answer. Each number comes from the LED resistor calculator, which solves the circuit for the standard resistor you will actually use and shows the LED glowing at that current.

Quick answerOn a 5 V Arduino pin use 150 Ω to 330 Ω for red, orange or yellow LEDs and 100 Ω to 180 Ω for blue, white or bright green. On a 3.3 V ESP32 or Pico pin use 150 Ω to 270 Ω for red, orange or yellow. White, blue and green LEDs need about 3.2 V, which leaves a 3.3 V pin almost no room, so drive them from 5 V through a transistor.

How do you calculate the LED resistor?

The LED holds roughly its forward voltage VfV_f. Whatever is left of the supply sits across the resistor, and Ohm's law turns that leftover voltage into a current:

R=Vs−VfIR = \frac{V_s-V_f}{I}

Then round up to the next standard resistor value, so the current lands at or just under your target. Rounding down pushes it over. The resistor's power is P=I2RP = I^2 R, and you want a part rated for at least twice that.

Example 1: red LED on an Arduino Uno pin

R=5.0−2.00.020=150 ΩP=(0.020)2×150=0.060 W=60 mW\begin{aligned}R &= \frac{5.0-2.0}{0.020} = 150\ \Omega \\ P &= (0.020)^2 \times 150 = 0.060\ \text{W} = 60\ \text{mW}\end{aligned}

150 Ω is a standard E12 value, so no rounding is needed. A 1/8 W (125 mW) or 1/4 W resistor has plenty of margin. With the kit's 220 Ω instead, the LED's voltage settles at about 1.98 V and the current is (5 minus 1.98) divided by 220, about 13.7 mA.

Red LED on a 5 V Arduino supply through a 150 ohm resistor (brown green brown bands): the LED glows, the schematic shows 3 V across the resistor and 2.00 V across the LED, and the current gauge reads 20 mA against a 30 mA limit
Figure 1. A red LED on 5 V with 150 Ω: 3.0 V across the resistor, 2.00 V across the LED, 20 mA. Open this setup in the simulator.

What forward voltage does each LED colour have?

The colour of an LED is set by its semiconductor, and the semiconductor sets the forward voltage. Red, orange and yellow LEDs are AlGaInP or GaAsP and sit near 2 V. Blue, white and modern bright green LEDs are InGaN and sit near 3.2 V. White LEDs are blue LEDs with a phosphor coat, so they share blue's voltage. The physics of that gap is in why blue LEDs need more voltage.

Typical figures from Kingbright's 5 mm datasheets: the WP7113ID high efficiency red is 1.9 V typical at 10 mA (about 2.0 V at 20 mA), the WP7113YD yellow 1.95 V at 10 mA, the WP7113NT pure orange 2.05 V at 20 mA, the WP7113VGC-Z InGaN green 3.2 V and the WP7113QWC/D white 3.3 V, both at 20 mA. Cree's C503D-WAN white is sold in voltage bins from 2.8 V to 4.0 V. The table below uses 2.0 V, 2.1 V and 3.2 V. One trap: old yellowish green LEDs are GaP parts with about 2.1 V, so a "green LED" can mean either. A multimeter's diode test settles it in seconds.

LED resistor values for Arduino 5V and 3.3V

The values below are the next E12 resistor at or above the formula, with the current the circuit then really draws. The model includes the small shift of LED voltage with current, which is why a 330 Ω resistor gives 9.2 mA rather than exactly 10.

LED colourVf5 V, 20 mA5 V, 10 mA5 V, 5 mA3.3 V, 10 mA3.3 V, 5 mA
Red2.0 V150 Ω (20.0 mA)330 Ω (9.2 mA)680 Ω (4.5 mA)150 Ω (8.9 mA)270 Ω (5.1 mA)
Orange2.0 V150 Ω (20.0 mA)330 Ω (9.2 mA)680 Ω (4.5 mA)150 Ω (8.9 mA)270 Ω (5.1 mA)
Yellow2.1 V150 Ω (19.3 mA)330 Ω (8.9 mA)680 Ω (4.4 mA)120 Ω (10.3 mA)270 Ω (4.7 mA)
Green (InGaN)3.2 V100 Ω (18.1 mA)180 Ω (10.3 mA)390 Ω (4.9 mA)not reliablenot reliable
Blue3.2 V100 Ω (18.1 mA)180 Ω (10.3 mA)390 Ω (4.9 mA)not reliablenot reliable
White3.2 V100 Ω (18.1 mA)180 Ω (10.3 mA)390 Ω (4.9 mA)not reliablenot reliable

Every resistor in the table dissipates 60 mW or less, so any 1/8 W or 1/4 W through-hole part works. For a status LED, 5 mA is usually plenty: modern indicator LEDs are clearly visible at that current, and a lower current keeps the chip cooler when several pins are lit. The 20 mA column is for when you want the LED as bright as its rating allows.

Green InGaN LED on 5 V USB through a 120 ohm resistor: the LED glows green and the current gauge reads 15.2 mA
Figure 2. A bright green InGaN LED needs about 3.2 V, like blue and white. On 5 V at 15 mA the formula gives 120 Ω and the LED draws 15.2 mA. Open this setup in the simulator.

How much current can an Arduino pin give an LED?

The ATmega328P datasheet lists 40 mA per I/O pin and 200 mA through the chip's VCC and GND pins, but both are in the Absolute Maximum Ratings table. That table is where the chip starts to get damaged, not where you should run it. The useful numbers are in the DC characteristics: with 20 mA flowing out of a pin at 5 V, the pin is guaranteed to stay above 4.2 V. That means a pin behaves like a 5 V source with up to about 40 Ω of resistance inside it.

Add that hidden 40 Ω to the 150 Ω resistor and the worst-case current falls from 20 mA to about 16 mA. Typical chips sag less, so real LEDs land between those two numbers. Either way, the conclusion is to design for 10 to 20 mA per LED and count the total: ten LEDs at 20 mA is 200 mA, right at the chip's limit. If you need more, an LED driver or a transistor switch is the clean fix. The same pins also need resistors as inputs, which the pull-up resistor guide covers.

The ESP32 datasheet is more generous on paper: up to 40 mA per pin at maximum drive strength with the output held above 0.8 × 3.3 V = 2.64 V. Espressif also notes that the available current drops as more pins source current at once. Treat 10 mA per LED as a comfortable design value on any 3.3 V board.

Why is a white LED on 3.3V a problem?

This is the case that catches people, so it is worth doing the calculation with real spread.

Example 2: white LED on an ESP32 pin at 10 mA

R=3.3−3.20.010=10 ΩR = \frac{3.3-3.2}{0.010} = 10\ \Omega

Only 0.1 V is left for the resistor. Now take two white LEDs from the same bag, one at 3.0 V and one at 3.6 V, both well inside a typical datasheet's range. With the same 10 Ω resistor the model gives:

Vf=3.0 V:I≈27 mAVf=3.6 V:I≈0.7 mA\begin{aligned}V_f = 3.0\ \text{V}: &\quad I \approx 27\ \text{mA} \\ V_f = 3.6\ \text{V}: &\quad I \approx 0.7\ \text{mA}\end{aligned}

A factor of about 40 between two "identical" LEDs. On a 5 V supply with 100 Ω the same spread gives 20 mA and 14 mA, a 30 percent difference, because the resistor has 1.8 V to work with instead of 0.1 V.

White LED on a 3.3 V ESP32 supply with a 10 ohm resistor: only 0.136 V is left across the resistor, the LED sits at 3.16 V and the gauge reads 13.6 mA, more than the 10 mA target
Figure 3. A white LED on 3.3 V with 10 Ω: just 0.136 V across the resistor, and 13.6 mA instead of the 10 mA target, because the LED's voltage at 10 mA is lower than its 20 mA rating. Open this setup in the simulator.

The resistor is supposed to set the current. With 0.1 V across it, the LED's own forward voltage sets it instead, and that varies from part to part and falls as the LED warms. Projects get away with it because the pin's output resistance adds some limiting, which is why a white LED straight on an ESP32 pin often "works". It works by accident.

Three honest fixes:

  • Use a red, orange or yellow LED: 150 Ω gives 8.9 mA on 3.3 V with 1.3 V across the resistor.
  • Power the LED from the 5 V (USB) rail and switch it with an NPN transistor or a small logic-level MOSFET. The pin then only supplies a fraction of a milliamp.
  • Use a constant-current LED driver if brightness matters, for example in a display or a lamp.

What about 12V, LED strips and higher supplies?

Higher supplies give the resistor more voltage to work with, so the current is very stable, but the resistor now does most of the work and gets warm. A blue LED on 12 V at 20 mA needs 440 Ω by formula, 470 Ω in practice, giving 18.7 mA. The resistor dissipates about 165 mW, more than the LED, so a 1/8 W part would run hot. Use 1/2 W. Better still, put three blue LEDs in series: 12 minus 9.6 leaves 2.4 V, so about 120 Ω and three times the light for the same current.

Blue LED on a 12 V supply through a 470 ohm resistor (yellow violet brown bands): 8.81 V across the resistor, 3.19 V across the LED and 18.7 mA on the current gauge
Figure 4. A blue LED on 12 V with 470 Ω: 8.81 V across the resistor, 18.7 mA and 165 mW of heat in the resistor. Open this setup in the simulator.

What happens if you get the resistor wrong?

Too big is harmless. A 10 kΩ resistor (brown black orange) picked by mistake gives a red LED on 5 V about 0.32 mA, a faint glow. If an LED lights weakly, check the bands first: it is almost always the resistor, not the LED. The resistor colour code calculator reads them for you.

Red LED on 5 V with a 10 kilohm resistor (brown black orange bands) by mistake: the LED barely glows and the gauge reads 0.321 mA, safe but dim
Figure 5. 10 kΩ instead of 150 Ω: 0.321 mA, dim but safe. Open this setup in the simulator.

Too small, or none at all, is the dangerous direction. An LED's current rises exponentially with voltage, so without a resistor nothing in the circuit sets the current except the supply's limit and the wiring. On a bench supply the LED flashes and dies. On an Arduino pin the pin's own resistance limits it to tens of milliamps, which overstresses both the pin and the LED and shortens their lives. The full explanation with I-V curves is in why LEDs need a resistor.

Red LED wired straight across 5 V with no resistor: the LED is shown burnt out and cracked, the circuit carries 0 mA after the LED fails open, and the gauge reads burnt
Figure 6. No resistor on a stiff 5 V supply: the LED burns out and fails open, so the current afterwards is 0 mA. Open this setup in the simulator.

Common mistakes with Arduino LEDs

  • Thinking the resistor must go on the positive side. It does not matter. A series loop carries one current, so the resistor works the same between pin and LED or between LED and GND.
  • Sharing one resistor between parallel LEDs. Small forward voltage differences make one LED take most of the current. Give each LED its own resistor.
  • Using PWM as a reason to skip the resistor. During each pulse the LED sees the full pin voltage. PWM changes how long the pulses are, not how much current flows in them.
  • Getting the LED backwards. The long leg is the anode and goes toward the positive side. The flat on the rim marks the cathode. A reversed LED simply stays dark at these voltages.

Try it yourself

Open the 3.3 V white LED setup in the simulator and move the supply slider slowly from 3.3 V up to 5 V. The resistor value climbs from 10 Ω to 100 Ω, and the current gauge stops jumping around as the headroom grows. Then type 220 into the custom resistor box and switch between colours to see what a single kit resistor does to each LED.

Sources

Frequently asked questions

What resistor should I use for an LED on an Arduino Uno?

For a red, orange or yellow LED, 220 ohms is the practical choice: about 14 mA, bright and well inside the pin’s limits. 150 ohms gives the full 20 mA. For a blue, white or bright green LED, 100 ohms gives about 18 mA and 150 ohms about 12 mA.

What resistor should I use for an LED on an ESP32 or Raspberry Pi Pico?

On a 3.3 V pin, use 150 ohms for a red, orange or yellow LED (about 9 mA). For white, blue or bright green LEDs there is only about 0.1 V of headroom, so no resistor value gives a predictable current. Use a red LED, or switch the LED from 5 V with a transistor.

Is 220 ohm or 330 ohm better for an Arduino LED?

Both are fine for a red LED on 5 V. 220 ohms gives about 14 mA and 330 ohms about 9 mA. Brightness looks similar because the eye responds roughly logarithmically, so 330 ohms is a good default when you drive several LEDs at once.

How much current can an Arduino pin supply for an LED?

The ATmega328P datasheet gives 40 mA per pin as an absolute maximum, not an operating value, and 200 mA for the whole chip’s supply pins. At 20 mA the pin is guaranteed to stay above 4.2 V. Design for 10 to 20 mA per LED and keep the total well under 200 mA.

Do I need a resistor if I use PWM to dim the LED?

Yes. PWM switches the pin fully on and off, so during each on period the LED sees the full 5 V or 3.3 V. The resistor sets the current during those pulses; PWM only changes how long they last.

Try it yourself
Related observations
Electronics 555 Timer Astable Circuit Explained with Waveforms Electronics 555 Timer Frequency Formula: Where 1.44 Comes From Electronics ADC Resolution vs Accuracy: ENOB, INL and the Reference
Transmit