A solenoid is a long coil of wire. When a current flows through it, each turn of the wire produces its own magnetic field. The solenoid is an example of an electromagnet because it only has a magnetic field while a current flows.
Inside the solenoid the fields from the individual coils add together. They point the same way, so they combine to form a very strong, almost uniform field along the centre of the solenoid. Almost uniform means the field has about the same strength and direction at every point.
Outside the solenoid the fields from the coils cancel each other out, which gives a weaker field. The field outside a solenoid has the same shape as the field of a bar magnet. A solenoid with many turns gives a much stronger field than a single loop of wire carrying the same current.