The temperature on the Moon can vary from boiling to freezing depending on whether it's night or day, but scientists think there might well be sheltered pits and caves where the temperature is quite reasonable – no matter what time it is.

In such spots, the temperature hovers around 17 degrees Celsius (63 degrees Fahrenheit), according to new calculations. They could be the perfect locations for establishing base camps to explore the rest of the lunar surface.

They might also offer some protection against small meteorites and even the harmful solar radiation coming from the Sun. With a comfortable base, future Moon settlers could focus on other endeavors – like growing food or carrying out research.

"Humans evolved living in caves, and to caves we might return when we live on the Moon," says planetary scientist David Paige from the University of California, Los Angeles (UCLA).

We've known about pits on the Moon for several years. The researchers used images captured by the NASA Lunar Reconnaissance Orbiter (LRO) – specifically its Diviner Lunar Radiometer Experiment thermal camera – to try and gauge the temperature inside a pit in the Mare Tranquillitatis region of the Moon.

Using computer models to analyze the thermal properties of the rock over time, the researchers gauged that the sunlit portion of the pit could retain heat to bake hotter than the surface, reaching as high as 300 degrees Celsius.

Yet, in the nearby shadows, the trapped warmth could boost the otherwise freezing cold temperatures to something a little more temperate and keep it there even after the Sun goes down.

The next question is if those overhangs have enough room for a community of explorers to huddle. Imagery shots from space suggest that some of them do – and indeed, that's the case on Earth, where tunnels are left behind by molten lava flowing underneath the surface. It's possible that some pits are collapsed lava tubes.

Part of the research involved aligning and collating multiple photographs, removing inconsistencies until the team could estimate the temperatures of individual pixels in the images captured by the LRO.

"Because nobody else had looked at things this small with Diviner, we found that it had a bit of double vision, causing all of our maps to be a bit blurry," says planetary scientist Tyler Horvath, also from UCLA.

Each day and each night on the Moon lasts about 15 days on Earth, with temperatures varying from around 127 degrees Celsius (261 degrees Fahrenheit) during the day to around minus 173 degrees Celsius (minus 279 degrees Fahrenheit) at night.

Both people and equipment would need protection from those extremes during long-term lunar research projects, which would be quite an engineering challenge; finding a habitable cave or two would be a very handy shortcut.

NASA plans to explore the region further during the proposed Moon Diver mission, which would see a rover run down inside the Mare Tranquillitatis pit and check out any cave networks it might be connected to.

"Lunar pits are a fascinating feature on the lunar surface," says planetary geologist Noah Petro from the NASA Goddard Space Flight Center in Maryland. "Knowing that they create a stable thermal environment helps us paint a picture of these unique lunar features and the prospect of one day exploring them."

The research has been published in Geophysical Research Letters.