Electromagnets are made by passing an electric current through a wire that has been wrapped around a soft iron core.