Yosemite National Park experiences a Mediterranean sort of climate with very mild, rainy winters and dry summers. Thunderstorms can be expected in the summers and snowfall is received at the high altitude areas. The seasons can be divided into the basis of peak tourist seasons and off season.
So the best time to visit Yosemite National Park is during the months of June to September. But large crowds can be expected during this period resulting in higher tariffs and long waits in queues. A couple of months before and after the peak seasons are great time to visit if you are comfortable with the weather and want cheaper rates.