You can visit Budapest throughout the year, and the chances are that you will find something going one. Climate wise the best time to visit is in either July, or September and October, when the weather is at its best.
August tends to be rathera low period for tourism in the city, although in the surrounding areas you will find plenty to do.
Winter, while brutally cold is a great time to visit, not only for the traditional Christmas markets, but also for the picturesque sight of Budapest under a layer of thick snow.