Fez or Fes (; Arabic: فاس, romanized: Fas, pronounced [faːs]; Berber: ⴼⴰⵙ, [faːs]; French: Fès, [fɛs]) is a city in northern inland Morocco and the capital of the Fès-Meknès administrative region. It is the second largest city in Morocco after Casablanca, with a population of 1.22 million (2020). Located to the northeast of Atlas Mountains, Fez is situated at the crossroad of the important cities of all regions; 206 km (128 mi) from Tangier to the northwest, 246 km (153 mi) from Casablanca, 189 km (117 mi) from Rabat to the west, and 387 km (240 mi) from Marrakesh to the southwest which leads to the Trans-Saharan trade route. It is surrounded by the high grounds, and the old city is penetrated by the River of Fez flowing from the west to east.
Fez was founded under the Idrisid rule during the 8th-9th centuries C.E. It consisted of two autonomous and competing settlements. The migration of 2000 Arab families in the early 9th century gave the nascent city its Arabic character. After the downfall of the Idrisid dynasty, several empires came and went until the 11th century when the Almoravid Sultan Yusuf ibn Tashfin united the two settlements and rebuilt the city, which became today's Fes el Bali quarter. Under the Almoravid rule, the city gained a reputation for the religious scholarship and the mercantile activity.
Fez reached its zenith in the Marinid-era, regaining the status as the capital. Numerous madrasas, mosques, zawiyas and city gates were constructed which survived up until today. These buildings are considered the hallmarks of Moorish and Moroccan architectural styles. Marinid sultans also founded Fes Jdid quarter, where newer palaces and gardens were established. During this time, the Jewish population of the city grew as well, with the Mellah (Jewish quarter) attracting the Jewish migrants from other North African regions. After the overthrow of the Marinid dynasty, the city largely declined and was replaced by Marrakesh for political and cultural influence, but remained as the capital under the Wattasids and modern Morocco until 1912.
Today, the city largely consists of two old medina quarters, Fes el Bali and Fes Jdid, and modern urban area of Ville Nouvelle constructed during the French colonial era. The medina of Fez is listed as a World Heritage Site and is believed to be one of the world's largest urban pedestrian zones (car-free areas). It has the University of Al Quaraouiyine which was founded in 859 and the oldest continuously functioning university in the world. It also has Chouara Tannery from the 11th century, one of the oldest tanneries in the world. The city has been called the "Mecca of the West" and the "Athens of Africa," a nickname it shares with Cyrene in Libya.