The climate of the Cocos (or Keeling) Islands, a territory of Australia in the Indian Ocean south of the equator, is tropical, with a hotter period from December to March, during which the maximum temperature hovers around 29/30 °C (84/86 °F), and a relatively cool period from June to October, during which the maximum temperature drops to around 27/28 °C (81/82 °F). The warmest months, albeit slightly, are February and March. The temperature is very stable, and it practically never gets either cold or very hot.
Here are the average temperatures of West Island.
West Island - Average temperatures
Min (°C)242525252524232323232424
Max (°C)293030292828272728282829
Min (°F)757777777775737373737575
Max (°F)848686848282818182828284

The relative humidity is always high, but the heat is tempered by the trade winds, which blow throughout the year, with a greater intensity in the coolest months (July and August), and a lower intensity in the warmest months (February and March).
Rainfall is abundant, around 2,000 millimetres (79 inches) per year; there is no dry period, even though the rains are more abundant from January to July, when they swing around 200 mm (8 in) per month, with a maximum in March and April. The least rainy period goes from September to November, when the rainfall amount is lower than 100 mm (4 in) per month. The rainfall records, however, are high even in the months that are generally less rainy, which means that during some years the rains do not follow the same pattern.
Here is the average precipitation.
West Island - Average precipitation

There is a fair amount of sunshine hours even in the wettest months, because the tropical rains occur mainly in the form of downpour or thundestorm, so they do not last long, however, the sun shines more often in the driest season.

Cocos Islands

For swimming, the sea is warm all year round, as you can see in the following table.
Cocos Islands - Sea temperature
Temp (°C)282828282828272727272727
Temp (°F)828282828282818181818181

Tropical cyclones

The Cocos Islands can be affected by tropical cyclones of the southern Indian Ocean, whose season runs from November 1 to May 15, although they are more frequent from December to March. However, in this area of the Indian Ocean, some tropical depressions (not intense) have also been formed in other periods, in June-July and September-October.

When to go

The best time to visit the Cocos Islands corresponds to the months of September and October, being on average the least rainy; however, some showers should be taken into account also in this period. August is typically an acceptable month as well, although it's a bit more rainy.

What to pack

All year round, light clothes, a scarf for the breeze, a light sweatshirt for the evening, light raincoat or umbrella, especially in the rainy season.