A solenoid is an example of an electromagnet (turned on and off by current). You can increase the strength of a magnetic field by wrapping the wire into a coil called a solenoid. Inside the solenoid, lots of field lines point in the same direction so the field is strong and almost uniform. Outside of the solenoid, a lot of the overlapping field lines cancel out so the field is weak at the end of it.