Magnets repel each other when like poles are close together, meaning two norths or two souths. This happens because the magnetic fields between the two magnets cancel each other out by pointing in opposite directions and away from one another. The magnetic field surrounding the magnets acts like an invisible rubber layer pushing them apart. On the other hand, magnets stick together when unlike poles are close together, meaning a north pointing to a south. The magnetic field acts like a stretched rubber band pulling the magnets together. The force exerted by magnets when they attract or repel each other is called magnetism, which is caused by the motion of electric charges. The actual magnetism in a piece of iron or in a permanent magnet is caused by electrons orbiting in one direction more than the other.