How it works
An LED drops a roughly fixed forward voltage (Vf). The resistor has to drop the rest of the supply voltage at the current you want, so its value is the leftover voltage divided by the current.
Standard resistors come in fixed series. The calculator rounds up to the next E12 value so the current ends up slightly below your target rather than above it, then shows the real current and the power the resistor will dissipate.
R = (Vsupply − n × Vf) / I
P = I² × RWorked example
A red LED (Vf ≈ 2.0 V) on a 5 V supply at 20 mA needs (5 − 2.0) / 0.020 = 150 Ω. 150 Ω is an E12 value, so the current stays at 20 mA and the resistor dissipates 0.06 W; a standard 1/4 W resistor is fine.