The energy radiating from the sun ranges from short ultraviolet waves to long infrared:

Ultraviolet 5%
Visible 46%
Infrared 49%

In the graph below, the difference between the “solar spectrum outside atmosphere” and the “solar spectrum at sea level” is what’s absorbed by the Earth’s atmosphere. The ozone layer absorbs the ultraviolet on the left side of the graph and protects us from sunburn.

Solar Spectrum

The UV portion is broken into three subcategories: A, B, and C. UVC has the shortest wavelength and highest energy. Ozone absorbs nearly all of it. That’s a very good thing, because you don’t want any. UVC lights are used as air filters in hospitals because it’s good at killing things - like bacteria.

Sunscreen blocks UVA (blacklights are UVA) and UVB. Some of the particles in sunscreen reflect electromagnetic radiation and others absorb the energy just like the atmosphere does. The SPF number of a sunscreen refers to it’s ability to protect you from UVB. From How Stuff Works:

All sunscreens are labeled with an SPF, or Sun Protection Factor. The SPF acts like a multiplying factor. If you would normally be OK in the sun for 10 minutes and you apply an SPF 10 sunscreen, you will be OK in the sun for 100 minutes. In order for the sunscreen to work, however, you have to apply plenty and it has to stay on. You should apply it about half an hour before going out in the sun (or the water) so it can bind to your skin — if you don’t, then it is very easy for the sunscreen to wash off.

,