How Earth's Rotation Creates Day and Night
Earth is always half-lit by the Sun and half in darkness. As Earth spins like a top, different parts of the planet rotate through the lit side and the dark side. When your location on Earth faces the Sun, you experience daytime. When your location rotates away from the Sun, you experience nighttime. This continuous spinning takes 24 hours to complete one full rotation.
The Axial Tilt
Earth's axis is tilted at about 23.5 degrees compared to its orbit around the Sun. This tilt does not cause day and night, but it does cause the seasons and explains why day length varies throughout the year. In summer, your location has longer days because it stays tilted toward the Sun for more of the rotation.
Why It's Not About Earth's Orbit
Many people think Earth's orbit around the Sun causes day and night, but this is incorrect. Earth's year-long orbit around the Sun causes the seasons, not the daily cycle of day and night. Day and night are purely caused by Earth's rotation on its axis, which happens much faster than its orbit.
Sunrise and Sunset
Sunrise occurs when your location rotates toward the Sun, and sunset occurs when it rotates away. During these times, you are at the boundary between the lit and dark sides of Earth, so the Sun appears at the horizon. The time of sunrise and sunset changes slightly each day because of Earth's tilted axis and its position in its orbit around the Sun.