This is a Java tutorial, which requires that you have Java, a free software, installed on your computer. It works best if you have the latest version of Java installed. If you are having trouble viewing or using this tutorial, try downloading the latest version of Java.
Magnetic fields are produced by electric currents; a simple segment of current-carrying wire will generate around it a circular magnetic field in accordance with the right hand rule.
You can create a stronger magnetic field by taking wire and forming it into a coil; the field is more concentrated in the center of the loop than outside the loop. By adding more loops to a coil, you create an increasingly stronger magnetic field. Stacking multiple loops also concentrates the field even more; this arrangement is known as a solenoid.
Iron filings are often used to reveal the shape of magnetic fields, as in the tutorial below. In the presence of a magnet, these filings will rearrange themselves according to the magnetic lines of force (flux lines).
The electromagnet above features a solenoid embedded in a table strewn with iron filings; the bottom half of the solenoid is just faintly visible below the tabletop. Click the Turn On button that controls the Knife Switch so that the circuit is electrified. Note the filings follow the field lines which are concentrated in the center of the solenoid where the magnetic field is most powerful.