To answer the question outright, we believe the best time to trek to Machu Picchu is from May to September when the weather is driest. Like most sub-tropical areas, the yearly weather cycle can be separated simply into two seasons - the wet and the dry season.
The dry season occurs between April and October with the clearest days usually occurring between June and September. However, the driest point of the season coincides with the Northern Hemisphere holiday period and, inevitably, this is the busiest period at Machu Picchu. It is also the busiest period on the Inca Trail and if you're planning on hiking to the citadel, you will have to book your Inca Trail permits well in advance. To avoid disappointment, we recommend booking permits at least 6 months prior to departure.
The wet season kicks off in November and gets into the full swing of things between December and February, easing off slightly in March. Although weather temperatures are fairly constant throughout the year, surprisingly, the hottest period is during the wet season which is Peru's summer. The wet season is marked by intense downpours and heavy humidity. This being said, it is also the quietest period at Machu Picchu and you'll often have the Inca Trail all to yourself. Please note that the Inca Trail is closed all of February each year.
The compromise option is to trek to Machu Picchu during the shoulder months of late March, early April or October/November. Although still risky, these months do not experience the same levels of rain as the high wet season and trails will still be relatively quiet.
If you're not to bothered about crowds, busy hotels and hordes of tourists flocking to Machu Picchu by train during the day, then we would definitely suggest trekking in the dry season as you'll have the best chance of experiencing Machu Picchu in all its beautiful glory. If you're a photographer and want to get that classic birds eye shot of Machu Picchu then you'll need to climb Huayna Picchu when you're there. Once again, the dry season is by far the best option for this.
Below we have provided several annual weather charts to help you decide the best time to trek to Machu Picchu.
Best time to trek to Machu Picchu - Temperature Chart
The chart below demonstrates the average high and low temperatures in Machu Picchu each year. You will notice that, like most sub-tropical areas, the temperatures are fairly consistent throughout the year. However, as the chart shows, the maximum highs and lows can fluctuate. When visiting Machu Picchu it should be noted that, although fairly warm during the day, temperatures at night can drop rapidly and, at some points in the year, drop to below zero. Therefore, always remember to bring layered clothing and something warm to wear at night.
Best time to trek to Machu Picchu - Rain chart
The chart below demonstrates the average monthly rainfall in Machu Picchu. The two seasons are very distinct in this chart and clearly demonstrate the risks of trekking to Machu Picchu during the wet season.
The chart below links to the one above and shows the average number of rain and drizzle days per month. Unsurprisingly the trend matches the average rain fall chart shown above. It should be noted that there is a possibility of encountering rain or drizzle any time during the year.
Best time to trek to Machu Picchu - Wind Chart
The chart below demonstrates the average monthly wind speeds (km/h) at Machu Picchu. As can be seen by the chart, average wind speed is relatively low and consistent. The light grey bars show the highest ever wind speeds recorded at Machu Picchu.
To Summarise
That's it folks, we hope we ave answered your question thoroughly enough. As stated, trekking to Machu Picchu in the dry season will give you the best weather and certainly the best chance of getting some cool photos and seeing the true splendor of the ancient city. The downside is of course the crowds. If you don't think you can handle the hordes of tourists then the wet season is still doable and Machu Picchu is open every day of the year. The experience in the wet season will be more peaceful and serene, but you will probably have to contend with getting soaked now and again.