The gunwale is the top edge of the side of a boat.
Originally the gunwale was the "gun ridge" on a sailing warship. This represented the strengthening wale or structural band added to the design of the ship, at and above the level of a gun deck. It was designed to accommodate the stresses imposed by the use of artillery.
In wooden boats, the gunwale remained, mounted inboard of the sheer strake, regardless of the use of gunnery. In modern boats, it is the top edge of the side where there is usually some form of stiffening.
On a canoe, the gunwale is typically the widened edge at the top of the side of the boat, where the edge is reinforced with wood, plastic or aluminum and to which the thwarts are attached. Modern cedar-strip canoes have gunwales which consist of inner and outer parts called "inwales" and "outwales". These two parts of the gunwale give rigidity and strength to the hull. The inwale will often have "scuppers" or slots cut into the inwale to allow water to drain when the canoe hull is turned upside down for storing.
On a rowing boat (especially in sports), the gunwale is sometimes referred to as the saxboard.
On a narrowboat or canal boat, the gunwale is synonymous with the side deck - a narrow ledge running the full length of the sides of the boat allowing a person (cautiously) to walk along the side of the cabin, generally with the aid of a handrail mounted on the roof.