Barcelona is blessed with the Mediterranean sea that moderates the weather in the city. When visiting a city it is important to know what to expect in terms of temperature and rain in each month of the year. The weather in Barcelona is good all year around, the temperatures are mild due to the sea that controls the temperature. Barcelona is not a rainy city either, we get the most rain in Sping time normally but they normally don't last a whole day just a few hours.
In summer Barcelona is hot and sweaty, there is a lot of humidity so you will feel the humidity in your skin, it is the favorite season to visit the city since it is perfect to go to the beach and enjoy the heat. It is the peak of the tourist season, so expect to find queues in the tourist attractions and crowded streets.
In August is very hot too, but I wouldn't recommend you to visit the city on that month since is when most local shops and restaurants close because locals get the whole month of holidays and get out of the city. If you want to see the authentic Barcelona, August might not be the best month, and historically is the hottest month.
My recommendation would be to visit the city in Autumn, around September and October, the weather is still good and you won't need a coat, with a thin jacket you will do and there will be plenty of sunny days in general.
Spring time is also a good time of the year to visit, between April and May but showers and rain are typical, as mentioned it is not a monsoon or a rainy city, so you will get some rain but you can still walk and enjoy the city. You just need a tiny umbrella to keep on your bag just in case. Even though it is the rainy season in spring, the temperature drops minimally.
Winter time is also an option, days are crisp to cold but they are normally sunny, and the temperature don't get below 3 or 4ºC, snow is very rare, as a local I have only seen snow once in the city.
Activities by season
Every season there are activities organized in the city, it is always a good idea to join local activities and if they are free even more. I will show you my selection of activities to do in Barcelona by season: