A couple of points in addendum to hrst's post:
- it's easier if you buy a switchmode or regulated wall-wart because these have constant output voltage regardless of load, unlike the transformer type.
- if you have a multimeter, measure the voltage drop across the LED while it is dimly lit, i.e. with about half or quarter as much current that it's rated for
- if you have a higher supply voltage like 12V, it makes sense to put multiple LEDs in series with one resistor as it's much more efficient and uses less resistors
So you would do some experimenting in this order:
- Look up the LED datasheet, which will specify a maximum current. Likely to be about 10mA for a tiny indicator LED and maybe 700mA to 1A for a big lighting LED
- Datasheet again, look for the "forward voltage", Vfwd. Should be about 1.5V, might be slightly higher.
- Decide what size resistor you need to put about 1/4 of the max current through it from your supply:
Itest = 0.25 * Imax
Rtest = (Vsupply - Vfwd) / Itest
For example with a 100mA-rated LED, Itest = 25mA. If Vsupply is 12V and Vfwd is about 1.5V, then Rtest = 420 ohms. Pick the next highest value in the series, which is 470 ohms. Wire up your supply, LED and resistor all in series and the LED should glow, though not necessarily very brightly. Put your multimeter in Voltage mode across the LED and measure the voltage drop. Now you know the exact Vfwd for your LED. Do this for a few LEDs.
Say you have 4 LEDs that you measured at 1.51V, 1.58V, 1.49V and 1.55V respectively (they will vary but probably not this much). When you put them in series, the voltage drop will be the sum of that, i.e. 6.13V - that's the forward voltage of your whole string of LEDs.
Now you need to choose a resistor to set the current in the string, using the same formula as above and a chosen current that is about half of the rated current:
R = (Vsupply - Vfwd) / I
Since for this example the LEDs are rated at 100mA (making them 150mW LEDs; 0.1A * 1.5V = 0.15W), we want to run them at about 50mA. That gives us R=117ohms and pick the next lower value in the series, which is 110 ohms. 100 ohms would also be OK - just means you're running them at slightly more than half their rated current. The number of LEDs you put in series is limited by your supply voltage, you need to have a little voltage left over for the resistor to drop, preferably no less than about 3V on a 12V supply. If you have a too-small voltage for the resistor (too many LEDs) then your current regulation will be poor: you may get a very different current and blow an LED.
The total current drain on the supply is the number of LEDs you have in parallel, not series. So if you have a chain of 4 LEDs in series running at 50mA, the total load is 50mA. However if you connect 5 LEDs in parallel (each must have its own limiting resistor, you can't use one limiting resistor for several parallel LEDs), the total load will be 250mA. If you like, you can make up multiple LED/LED/LED/LED/R chains and place those in parallel. That way you could have for example 20 LEDs for a total load of 250mA on the supply.