The ozone layer is formed by solar UV breaking oxygen (O2) into two highly reactive oxygen atoms (O), which then combine with their own oxygen molecules to form ozone molecules (O3). The ozone molecule can also absorb UV, breaking it back up into O and O2, which can later recombine into O3 again. This cycle keeps absorbing solar UV and produces heat in the upper stratosphere.

 

The ozone layer essentially filters out the UV that is harmful to life on the surface of Earth. Visible light from the sun passes through and reaches the surface (which is good, or else the Earth would have a hard time warming up to comfortable temperatures).