Mercury has a very thin atmosphere. Because of this, the planet's surface can reach up to 467 degree celsius when the sun's ray are directly facing it. Although it is the closest planet to the sun, it is not the hottest because its thin atmosphere cannot trap the heat for a long time. So, Mercury can also have very low temperatures, which can sometimes reach as low as -187 degrees celcius for the parts that cannot retain the heat