Zanzibar's sea breezes have a cooling effect on a typical tropical climate which is generally hot and somewhat humid throughout the year.
If you want to avoid most of the rain however, you'll need to consider when to go to Zanzibar carefully: there are two distinct rainy seasons - mid-March to late May and again in November - which means many people take a Zanzibar holiday during the hot and dry December to February months.
The June to October spring months offer similarly dry weather but with cooler temperatures, and this period is often regarded as the best time to visit Zanzibar.
Diving in Zanzibar and its outlying islands is possible all year round though most divers avoid the March to May rainy season. We'd recommend the north coast of Zanzibar from June to October and the south coast between November and March, or just stick to Zanzibar's 'classic' dive months of July and August as well as February and March.