Good question!
The moon is about 150 million kilometers away from the sun, but it can get closer and further away.
As the moon orbits the Earth, when it is one side of the Earth it is closer to the sun than the other. Also the Earth doesn’t orbit the sun in a complete circle but more of an oval, so at some points the moon is even further or closer to the sun!
Comments