Caption: Magnetic field of a solenoid. Solenoid (centre) and iron filings (black) marking the field lines of its magnetic field. A solenoid is simply a coil of electrical wire. When electricity flows through the wire, a magnetic field is created. Any current flowing through a wire will have a magnetic field, but the coiling of a lot of wire produces a strong magnetic field like that of a bar magnet. This is a phenomenon known as electromagnetism, and the solenoid is known as an electromagnet. It can be used to magnetize materials like iron, and also to generate motion (as in an electric motor) and to generate electricity (as in a dynamo).