For example, any LED's datasheet provides recommended forward voltage (usually between 1.5-4V for LEDs), which must be reached to turn ON the LED. However, when voltage exceeds the recommended forward voltage value, the LED's internal resistance quickly decreases. Therefore, the LED will begin to draw a substantial current and in some installations may burn out. To address this problem, a resistor is placed in series with the LED to keep its current at a specific level called recommended forward current. This resistor is called current limiting resistor.

According to the diagram above, in order to calculate a current limiting resistor, we need to know three values in order to determine the value of current limiting resistor.
i = LED forward current in Amps (provided by the LED's datasheet)
Vf = LED forward voltage drop in Volts (provided by the LED's datasheet)
Vs = supply voltage
These three values are inserted to the equation below to determine the value of a current limiting resistor:

EXAMPLE:
i = 20 mA or 0.02 A
Vf = 1.7 Volt
Vs = 5.0 Volt
R = (5.0 - 1.7)/0.02 = 165 Ohm