How to Choose an LED Series Resistor

Start with the LED and source datasheets
A series resistor limits current only when the LED is driven from a voltage source in a suitable simple circuit. Record the supply minimum and maximum, LED forward-voltage range at the intended current and temperature, maximum LED current, source-pin limits, duty cycle, and resistor ratings.
Do not use this method for mains, high-power LED modules, unknown strips, or drivers that require regulated current. Those systems need their specified driver and thermal design.
Choose a target below every limit
Select the operating current needed for useful brightness while staying within the LED continuous and pulse limits, the controller or supply output limit, connector and trace capability, and thermal conditions. Indicator LEDs often need less current than a copied example suggests.
Maximum current is a boundary, not a design target.
Calculate from worst-case voltage
For one LED and one resistor in series, subtract the LED forward voltage from the supply voltage to find the resistor voltage, then divide by target current to estimate resistance. Use consistent units. For the highest-current case, use the highest supply and the lowest credible LED forward voltage under the stated conditions.
Then evaluate the lowest-current case with the lowest supply and higher forward voltage to ensure the indicator still works. Forward voltage varies among parts and with current and temperature, so one typical datasheet number is insufficient.
Choose a standard value conservatively
Select an available resistor value that does not push worst-case current above any limit. A slightly higher resistance usually reduces current and brightness. Include resistor tolerance and source-voltage tolerance in the check.
Review resistor power, voltage, and pulse ratings rather than choosing by resistance alone.
Calculate resistor dissipation
Use the worst-case resistor voltage and current to determine heat. Select a resistor whose allowed power at the actual ambient, enclosure, board layout, and duty cycle has suitable margin. Touch is not a calibrated temperature measurement; use a safe documented method and deenergize before changing the circuit.
Check source-pin constraints
A microcontroller or logic output may have per-pin, port, and total device-current limits plus output-voltage change at load. Read the exact datasheet. If the desired LED current exceeds what the pin can safely drive, use a documented driver stage rather than asking a tiny output transistor to pursue a second career.
Semiconductor switching basics can explain the concept, but a real design requires device and source calculations.
Wire polarity correctly
Confirm LED anode and cathode from the exact part documentation; lead length and package flats are helpful only when the package follows that convention and has not been trimmed. Put the resistor in series on either side of the LED as the schematic permits. It cannot limit current when accidentally placed in parallel.
Map the circuit using breadboard connection rules and inspect for rail gaps or shorts.
Power with a current limit
Set the isolated low-voltage supply to the correct voltage and a protective limit appropriate to the expected whole-circuit current. Start low, power briefly, and check supply current, LED polarity, resistor voltage, and temperature. If current disagrees with calculation, deenergize and find the wiring or assumption error.
Never stare into high-intensity or ultraviolet emitters, and follow optical safety information. For an ordinary indicator, successful engineering is pleasantly dull: it lights, nothing heats, and the resistor keeps its opinions to itself.