Cardiff is a year-round city but the best time to visit is late spring and early summer (May–June) when the weather is reliably decent and the city is at its most animated without being overwhelmed by visitors. The days are long and the parks and waterfront work well in good weather.
Autumn is pleasant too — September and October bring some of the sharpest light of the year and smaller crowds. The arts season (opera, concerts at St David's Hall) gets going in September.
Be aware of rugby internationals. Six Nations matches at the Principality Stadium (February–March) fill the city completely and push accommodation prices to their highest. If you want to experience match day Cardiff, book very early; if you want a quieter city, avoid those weekends.
Cardiff is drizzly year-round in the classic Welsh way. Bring a waterproof regardless of season.