Resistor for an LED

Calculator for the resistor that limits the current through an LED

Usource = V
ULED = V
ILED = mA

How it is calculated

An LED is not an ordinary light bulb: if we connect it straight to a power source, too much current flows through it and the LED burns out. That’s why we connect a resistor in series with it. The LED keeps its own voltage ULED, and the rest of the source voltage drops across the resistor. From that and the current we want, we get the resistance:

\[ R = \frac{U_{source} - U_{LED}}{I_{LED}} \]

We type the current in milliamps (mA), but in the formula it goes in amps (A): 20 mA = 0.020 A.

Example: a red LED on an Arduino ⇒ R = (5 V − 1.8 V) / 0.020 A = 160 Ω.

Standard values

There is no 160 Ω resistor in the box. Resistors are made in a series of standard values (the E12 series: 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 and the same digits with more zeros). The calculator takes the next bigger value, 180 Ω, because a bigger resistance means a little less current, and that doesn’t harm the LED or the Arduino. Read the colour bands of that resistor on the Resistors page.

If that exact value isn’t in the box, take the next bigger one you have. The LED will be a little dimmer, but safe.

LED voltages

The voltage depends on the LED’s colour. The calculator uses typical values for 5 mm LEDs; you can find the exact value for your LED in its description (datasheet).

ColourULED
red1.8 – 2.2 V
orange, yellow2.0 – 2.2 V
green2.0 – 3.2 V
blue, white3.0 – 3.4 V

Green LEDs come in two kinds: older, yellowish-green ones have about 2 V, and bright green ones about 3 V.

Do we need 20 mA?

Most LEDs can take 20 mA, but they are already bright at 5 to 10 mA. With less current the Arduino pin has less load, so we can connect more LEDs to the Arduino at once.