Best time to visit Barcelona is from April to June and September to November. July and August can be brutally hot not to mention teeming with tourists. From December to March, the weather can be rather chilly.
Barcelona's climate is Mediterranean. Spring and autumn are mild and somewhat rainy (it's a good idea to pack a raincoat). Winter is also mild while the summers are sunny and hot, with temperatures above 30º C at times. Light clothes and a head cover are advisable.