When you talk about resistor with LED then first in your mind got Why do you need an LED resistor?
Resistor used in LED to limit the LED current to a safe value. increase life of LEDs by limiting over value current passing through it by resistor between LED and power supply.
In Short: To limit the LED current to a safe value.
In Details: LEDs are semiconductor, especially diodes. The current that circulates in an LED is an exponential function of the LED voltage. The important part for this is that a small change in voltage can produce a huge change in current. This is the most important concept of this article. Resistances are not so. Current and voltage in a resistor are linearly connected.
This means that a change in voltage will produce a proportional change in current. Current vs. voltage is a straight line for a resistor, but not at all for an LED.
For this reason, you can not say that the LEDs have “resistance”. Resistance is defined as the constant ratio of current to a resistor circuit. Even worse, there is no real way to know exactly the relationship between current and voltage for any LED given in all possible voltages other than direct measurement.
The exact relationship varies between different colors, different sizes, and even different batches from the same manufacturer. When you buy an LED, you should come with a rating that looks like this: 3.3V @ 20 mA typical. This gives you a point along the curve.
Usually, this is a safe operating point. In addition, you can get a maximum rating. It may be in the form of a voltage or a current. For example, a lot of people report purchasing “5V blue LEDs”. They are not really rated to operate continuously at 5V in most cases.
Another thing I would like to remove from this article is the idea that it is more useful to talk about driving a LED with a current of a certain size instead of a voltage. If you know the voltage on an LED, you can not determine the current flowing in it unless you operate it at the exact point along the curve described in the specifications. Worse, being “off a bit” in voltage before can have a drastic effect in the current. So the preferred approach is to select a current limiting resistor to obtain a target current in the LED.
Most 3mm and 5mm LEDs will work close to maximum brightness at a 20mA current. This is a conservative trend: it does not exceed most ratings (your specifications may vary or you may not have specifications – in this case, 20 mA is a good default estimate). In most cases, driving the LED at a higher current will not produce substantial additional light.
Instead, the junction (the working parts of the LED) must dissipate excess heat as heat. Joining the junction will reduce useful life and can significantly reduce LED power. Sufficient heating will cause a catastrophic failure (producing an emitting diode in the dark).