In Rio de Janeiro, a big city of Brazil and the capital of the state of the same name, the climate is tropical, with a relatively cool season from May to October and a hot, muggy season from December to March, with November and April as intermediate months. The daily average temperature ranges from 21.5 °C (70.5 °F) in July to 27 °C (81 °F) in January and February.
The city lies on the coast: the famous beaches of Copacabana and Ipanema are located along the coast of the Atlantic Ocean, while the city overlooks the Guanabara Bay, where there is also the Rio de Janeiro-Galeao airport, named after Antônio Carlos Jobim.
Around the city, there are hills covered with forests, reaching about a thousand meters (3,300 feet) of altitude. Mount Corcovado, or Monte Cristo, on top of which is the famous statue of Christ the Redeemer, is 710 meters (2,329 feet) high, which means that on the summit, the temperature is about 4 degrees Celsius (7 °F) lower than on the plains. The Sugarloaf Mountain, accessible by cable car with a stunning view, is instead at the entrance of the bay, and it's 396 meters (1,300 feet) high.
Here are the average temperatures (recorded along the coast, in Saúde district).
Rio de Janeiro - Average temperatures
Min (°C)232423222019181919202122
Max (°C)293029282625252625262729
Min (°F)737573726866646666687072
Max (°F)848684827977777977798184

Although the average temperatures are not very high, and thankfully the breeze usually blows, relieving the heat, during the warm season, very hot days can sometimes occur, with highs around 35/37 °C (95/99 °F), from October to April. However, summery days can occur even in winter, with highs around 30/32 °C (86/90 °F) also in June, July and August.
On the other hand, during the cool season, from May to October, cold air masses of Antarctic origin can bring cool temperatures, or even a little cold at night, in fact, lows can drop to around 10/12 °C (50/54 °F), and highs can stay around 18/20 °C (64/68 °F). This happens in the city proper, in the districts lying along the coast, but in the localities of the metropolitan region situated to the north-west and far from the sea, like Nova Iguaçu, lows can even drop below 10 °C (50 °F).

Cable car to Sugarloaf Mountain

Rrainfall amounts to around 1,050 millimeters (41.5 inches) per year, so it is relatively abundant. The wettest season is summer, from December to March (remember that the city is located in the Southern Hemisphere), when the rains mainly occur in the form of showers or thunderstorms. Winter is quite dry, but at times, some disturbances can affect this area, bringing some days of bad weather, and also cool temperatures. This happens mostly in mid-winter (in the months of June, July and August), but it can also occur in the months of May, September and October (which, all in all, are not so different).
Here is the average precipitation.
Rio de Janeiro - Average precipitation

The amount of sunshine in Rio is good, but not great. In summer, the sky is often clear or partly cloudy, but some cloud banks can form, more or less intense, associated, as mentioned, with showers and thunderstorms: there are on average 7 hours of sunshine per day from January to March. In winter, the relatively dry season, as I said, there can be some cloudiness linked to depressions: there are about 6 hours of sunshine per day from June to August, and 5 in September and October. Here are the average sunshine hours per day.
Rio de Janeiro - Sunshine

The sea is warm enough for swimming from November to May, when the water temperature is equal to or higher than 24 °C (75 °F), or even in June, when it drops to 23 °C (73 °F). From July to October, it is a bit cool, but not impossible after all, since it remains around 22 °C (72 °F). Here are the average sea temperatures.
Rio de Janeiro - Sea temperature
Temp (°C)252626252423222222222425
Temp (°F)777979777573727272727577

Best Time

The best time to visit Rio de Janeiro is winter, from May to October: temperatures are generally pleasant, with quite rare rains. It will be possible to spend a relaxing time on the beaches, to sunbathe, and to try to swim in a sea a little cool. A sweatshirt and a light jacket can help for the evening and on cool and cloudy days.
In summer, the weather is hot and muggy, sometimes very hot, and thunderstorms can break out, but there is also a lot of sunshine. As there is no danger of cyclones, if you want, you can go in this season as well, at least if you do not suffer from the heat, and you have in mind long periods on the beach. It may be useful to book a hotel with air conditioning, and bring a sweatshirt or a pashmina for airconditioned places.