The top on a traditional square rigged ship, is the platform at the upper end of each (lower) mast. This is not the masthead "crow's nest" of the popular imagination – above the mainmast (for example) is the main-topmast, main-topgallant-mast and main-royal-mast, so that the top is actually about 1/4 to 1/3 of the way up the mast as a whole.
The main purpose of the top is to anchor the shrouds of the topmast that extends above it. Shrouds down to the side of the hull would be at too acute an angle from the mast, so crosstrees running sideways out from the mast to spread the topmasts shrouds. These crosstrees rests on two trestle trees running fore and aft, which themself are placed on top of the cheeks of hounds, bolted to the sides of the mast. Placing a few timbers onto the crosstrees produces a useful platform, the top. The futtock shrouds carry the load of the upper shrouds into the mast below.
At the upper end of the topmast and topgallant, there is a similar situation regarding the next mast up (topgallant and royal respectively). At these points a smaller top might be constructed, but it is more usual simply to leave the shroud-bearing struts open, in which case they are known as crosstrees.
Access for sailors to the top may be by a Jacob's ladder, lubber's hole, or the futtock shrouds.
A foremast might be stepped into a similar fore-top platform on the foremast. A mizzen-top would be a platform on the mizzenmast. Similar main-top and fore-top platforms have been retained on steam ships and motor vessels as preferred locations for installing rotating radar antennae.
A fighting top was an enlarged top with swivel guns, designed to fire down at the deck of enemy ships. They could also hold sailors or marines armed with muskets or rifles; Horatio Nelson was mortally wounded at the Battle of Trafalgar by a sniper firing from a fighting top of the Redoutable.