The time of year when you choose to come to Essaouira will depend largely on what you want to do there. Essaouira is generally breezy but pretty much always sunny and seldom above 30 degrees C (or below about 18 degrees in the daytime) all year round. If it rains, it really goes for it, but this is generally only in the winter months and probably for less than 10 days a year. It seldom rains and seldom for more than a day.
Some of the more luxurious hotels and guest houses offer air conditioning, but it is hardly necessary – open a window and you’ll get the same effect! At times, it can be downright windy – in winter, in poorly insulated homes, you may need an extra blanket or an electric heater at night. In the day, even in winter the wind is not really cold, but it is sometimes strong (usually from the north) and often carries a lot of dust, so bring a scarf (to put over your mouth on really bad days) and large-framed sunglasses (against sun and sand!).
Watersports fanatics tend to come when they know the wind is in the right direction and the waves are right for their sport. (Wind Guru is the favourite wind, wave and weather website). Golfers often come in spring and autumn, avoiding the heat of the summer, when European golfing destinations are still a bit cool and the famous Essaouira tradewinds have reduced to a breeze.
If you come for cultural events, you may time your visit to coincide with one of Essaouira’s many festivals, such as the Gnaoua World Music Festival (June), the Printemps Musical des Alizés (April) or the Festival des Andalousies Atlantiques (Oct/Nov).
If you are coming just to check the place out, to chill out and soak up the vibe and you are not tied to school holidays, my suggestion would be to come in April/May/June or September/October to get the best weather. Spring and autumn are also ideal times of year to combine your trip to Essaouira with time in Marrakech or the desert, both of which are extremely hot (above 40 degrees C) in the summer months (July/Aug). If you come in early Spring, you can also make an excursion into the foothills of the Atlas mountains or the Ourika Valley, where fruit and nut trees scatter their beautiful blossom with the slightest breeze.
For the next few years Ramadan falls in summer, which can pose certain challenges for travellers to Muslim countries (read about travelling in Ramadan here).