Mainsail

A mainsail is a sail rigged on the main mast of a sailing vessel.
Historical fore-and-aft rigs used a four-sided gaff rigged mainsail, sometimes setting a gaff topsail above it.
Whereas once the mainsail was typically the largest sail, today the mainsail may be smaller than the jib or genoa; Prout catamarans typically have a mainmast stepped further aft than in a standard sloop, so that the mainsail is much smaller than the foresail.
Bermuda rig.
The modern Bermuda rig uses a triangular mainsail aft of the mast, closely coordinated with a jib for sailing upwind. A large overlapping jib or genoa is often larger than the mainsail. In downwind conditions (with the wind behind the boat) a spinnaker replaces the jib.
Some mainsails are "full-batten" mainsails, meaning the batten extends all the way from the mast to the leach of a sail. A partial batten extends from the leech partway to the mast. Battens enable the mainsail to project farther away from the mast. However, there is some cost associated with the battens themselves, "batten pockets" need to be sewn into the sail, and "batten cars" may be needed to allow the sail to be raised and lowered.
Before Nathanael Greene Herreshoff's invention of sail tracks and slides in the 1880s, mainsails were limited in height. Traditional mainsails were held against the mast by hoops that went the full way around the mast. This meant a traditional mainsail could be raised no higher than the first point a rope or wire was required to keep the mast upright. Further mainsail area (and height) was obtained by adopting a gaff rig.
A mainsail may be fixed to the boom via slugs, cars, or a bolt-rope, or may be "loose-footed," meaning it is only attached at the tack and clew.