The longest day of the year occurs on the summer solstice, which takes place in June in the Northern Hemisphere and December in the Southern Hemisphere. The solstice occurs between June 20 and 22 or between December 20 and 23 each year.
The solstice occurs due to the planet's axial tilt. As the Earth orbits the sun, its Northern Hemisphere alternately tilts toward the star or away from it. When one hemisphere is tilted toward the sun, it experiences longer days and hotter temperatures. The day on which the axis is tilted furthest toward the sun is the solstice, and thus the longest day of the year. Since the hemispheres tilt in opposite directions, the longest day for the Northern Hemisphere is the shortest for the Southern Hemisphere, and vice-versa.