There are several ways. If you wrap a wire (electrical) around a nail, and then run a current/charge through that wire, the nail will become a magnet. It takes a lot of wire coils, though, and it's only a magnet so long as the current is running through it. Also, you can take an existing magnet and a needle and run the needle along the magnet about 50 times in one direction. Don't change directions while swiping. Or you can get one at a hobby store…it's less troublesome and more permanent.