Two days is enough for Marrakech if you accept one rule: do the medina early. Between 9 and 11 a.m. the alleys are working streets, not a marketplace aimed at you.
Day one: Koutoubia at 08:30, Ben Youssef Madrasa at 09:15 when it opens, then let yourself get lost northwards towards the tanneries. Lunch at a rooftop above the spice square, then the Bahia Palace in the late afternoon light. Dinner at the Jemaa el-Fna stalls.
Day two: Majorelle Gardens at opening time (book online, the queue is real), then the Yves Saint Laurent museum next door. Afternoon in Gueliz — the new city — for the concept stores, galleries and coffee that is actually good. Sunset at a rooftop in Kasbah.
If you have a third day, leave the city. Ourika, Agafay or Essaouira all work as day trips and all three feel like a different country.
One warning: the “the square is closed today, come to the tannery” line is a scam that has been running for thirty years. The square is never closed.