Yes, the greenhouse effect is a natural process that warms the Earth’s surface. It occurs when the Sun's energy reaches the Earth and is either reflected back to space or absorbed and re-radiated as infrared energy (heat). Greenhouse gases in the atmosphere, such as carbon dioxide (CO₂), methane (CH₄), and nitrous oxide (N₂O), trap some of this infrared radiation, preventing it from escaping back into space.
This process helps to maintain the Earth's temperature and creates conditions suitable for life. However, human activities, such as burning fossil fuels and deforestation, have increased the concentration of greenhouse gases in the atmosphere, enhancing the greenhouse effect and contributing to global warming and climate change.
So, to summarize, greenhouse gases do indeed trap heat and hinder its escape into space, leading to a warming of the planet.