databit.me

Calculator

LED Resistor Calculator

Find the current-limiting resistor for any LED and supply voltage.

V
V

Red ≈ 2.0, green ≈ 2.1, blue/white ≈ 3.2

mA

Result

Calculated resistor
300 Ω
Use standard value (E12)
330 Ω
Actual LED current
9.09 mA
Resistor power
27.3 mW
Suggested rating
1/8 W
Ad space · top

How it works

An LED will happily draw as much current as your supply can push through it — right up until it burns out. A series resistor limits that current. This calculator works out the resistor value from the supply voltage, the LED's forward voltage and the current you want, then rounds up to a standard E12 value you can actually buy.

Typical forward voltages are about 1.8–2.2 V for red, 2.0–2.2 V for yellow/green, and 3.0–3.4 V for blue, white and true-green LEDs. For microcontrollers, 5–10 mA is usually bright enough and keeps the pin well inside its limits (ESP32 and Pico pins are happiest at under 12 mA).

Formula

ResistorR = (Vs − n × Vf) / I
Power in resistorP = I² × R (use at least 2× margin)

Worked example. 5 V supply, red LED (Vf = 2.0 V), 20 mA: R = (5 − 2.0) / 0.020 = 150 Ω. The nearest standard value at or above is 150 Ω (E12: 150 Ω).

Ad space · inline

Frequently asked questions

Why round up to the next standard value?

A slightly larger resistor gives slightly less current, which is the safe direction. Rounding down would push the LED above your target current.

What current should I choose for an LED?

Most standard 5 mm LEDs are rated for 20 mA continuous, but they are already bright at 5–10 mA. Choosing less extends life and is easier on microcontroller pins.

Can I connect several LEDs with one resistor?

Yes — in series, as long as the supply voltage is higher than the sum of all forward voltages. Enter the number of LEDs in series. For parallel LEDs, give each its own resistor, because small differences in Vf make one LED hog the current.

Do I need a resistor on a WS2812 / NeoPixel?

No. Those LEDs have built-in constant-current drivers. A small series resistor (about 330 Ω) on the data line is good practice, though.

Boards this helps with

Free download

The Microcontroller Cheat Sheet

Logic levels, pins to avoid, I2C / SPI / UART basics and a quick-pick table of the best boards — on one printable PDF. Enter your email and it's yours.

Only used to send the sheet and the odd databit.me update. See the privacy policy.