The Earth is like a huge magnet, and its magnetic influence extends far into space. The magnetosphere is that area of space, around the Earth, that is controlled by the Earth's magnetic field. It is made up of positively charged protons and negatively charged electrons.
All magnetic objects produce invisible lines of force that extend between the poles of the object. In the simplest terms, Earth can be thought of as a dipole (2-pole) magnet. Magnetic field lines radiate between Earth's north and south magnetic poles just as they do between the poles of a bar magnet. Charged particles become trapped on these field lines forming the magnetosphere.
Earth's magnetic field lines are not as symmetrical as those of the bar magnet. The impact of the solar wind - the constant stream of high energy particles - causes the lines facing towards the Sun to compress, while the field lines facing away from the Sun stream back to form Earth's magnetotail. The magnetosphere extends into the vacuum of space from approximately 80 to 60,000 kilometers on the side toward the Sun, and trails out more than 300,000 kilometers away from the Sun.
Earth's magnetic field protects us from the harmful effects of the solar wind. A great deal of the matter in the solar wind is deflected sideways around the Earth by the magnetosphere. The solar wind would singe our atmosphere if not for the Earth's magnetic field. Many of the remaining particles that are given off by the Sun are concentrated into belts or layers called the Van Allen radiation belts.