LED Series Resistor Calculator
The resistor eats the voltage the LED can't. Size it here and your LED gets its 20 mA instead of a short bright life.
V
V
mA
-
The formula and the forward voltages
R = (Vs − Vf) ÷ If. The only part you need to look up is Vf, and it tracks the color: red and yellow sit around 1.8 to 2.2 V, green and blue around 3 to 3.4 V, white around 3.2 V. Most indicator LEDs are happy anywhere from 5 to 20 mA; they're plenty visible at the low end.
Round up, not down
The calculator suggests the next standard E12 value above the exact answer. Rounding up means slightly less current, which an LED never minds. Rounding down means more current, which it eventually does. Check the dissipation figure too: past a quarter watt you want a bigger resistor body, not just the right ohms.