A city gate is a gate which is, or was, set within a city wall. It is a type of fortified gateway.
City gates were traditionally built to provide a point of controlled access to and departure from a walled city for people, vehicles, goods and animals. Depending on their historical context they filled functions relating to defense, security, health, trade, taxation, and representation, and were correspondingly staffed by military or municipal authorities. The city gate was also commonly used to display diverse kinds of public information such as announcements, tax and toll schedules, standards of local measures, and legal texts. It could be heavily fortified, ornamented with heraldic shields, sculpture or inscriptions, or used as a location for warning or intimidation, for example by displaying the heads of beheaded criminals or public enemies.
Notably in Denmark, many market towns used to have at least one city gate mostly as part of the city's fortifications, but during the Age of Absolutism their functions become closely linked to the collection of customs, the so-called octroi, which from 1660 onwards was charged to the market town's coffers. When absolutism in Denmark came to an end after the revolutions of 1848, gate consumption was abolished in 1852, and since then the city gates also began to disappear.
Medieval Danish city gates are found today only in Vesterport, Faaborg, and Mølleporten, Stege, as well as in Flensburg, today in Germany. Further city gates, in one form or another, can be found across the world in cities dating back to ancient times to around the 19th century. Many cities would close their gates after a certain curfew each night, for example, a bigger one like Prague or a smaller one like the one in Flensburg, in the north of Germany.
With increased stability and freedom, many walled cities removed such fortifications as city gates, although many still survive; albeit for historic interest rather than security. Many surviving gates have been heavily restored, rebuilt or new ones created to add to the appearance of a city, such as Bab Bou Jalous in Fes. With increased levels of traffic, city gates have come under threat in the past for impeding the flow of traffic, such as Temple Bar Gate in London which was removed in the 19th century.