This is the old walled town, with some of its historic gates still standing, and it is the reason the city is called the "Blue City" or "the Blue Pearl" of Morocco. The name means "look at the horns", after the two peaks that rise above it.

Chefchaouen began in 1471 as a small fortress built by Ali ibn Rashid al-Alami to defend the region against Portuguese attacks. It grew into a town with the arrival of Muslims and Jews from al-Andalus and Spain, especially after the fall of Granada in 1492 and the last expulsions of 1609, who built their quarters on the steep slopes in the Andalusi manner. That heritage shows in the curved brick arches over the narrow alleys, in houses built around a central courtyard planted with orange and lemon trees and jasmine, and in the Andalusian music many local families still keep.

At the centre of the old town lies Uta Hammam Square, also written Place Outa Hammam, a market square lined with shops and cafés that takes its name from a bathhouse in its northwest corner. Around it stand the Kasbah, the Great Mosque, historically the city's principal mosque, and the largest of the four caravanserais, whose plain courtyard building is marked by a tall entrance under a pointed horseshoe arch. In the middle of the square is a four-sided fountain, each face set with a blind arched niche, now under a green-tiled roof. Southwest of the Kasbah lies Souika, a neighbourhood dating from the 15th century, named after the small market that stood there from its earliest days; one archway of its old enclosure survives, along with the Aïn Souika wall fountain.

The Kasbah is the original citadel: a rectangular rammed-earth enclosure with ten towers and a taller stone tower on the west side, probably added in the early 16th century, which has rooms under brick domes and recalls the tower-houses of Granada. Its courtyard is now a garden, and a historic house in its northeast corner holds a museum of archaeology and ethnography. The tourist office describes the gardens as a cool retreat in the middle of the old quarter.

The walk through the winding alleys is the main attraction, with the smell of fresh bread and tagines in the lanes. Just east of the medina, outside the old walls, is Ras al-Ma', the spring that first supplied the city, with an old mill and a bridge nearby. On a hill to the east, the Spanish Mosque, a disused mosque built in the 1920s, serves as a lookout over the town. The paths of the surrounding Rif mountains are good for hiking.