Photosynthesis is the process by which plants capture energy from sunlight and use it to produce food. It occurs in two stages: in the first stage, chloroplasts in plant cells absorb sunlight using the pigment chlorophyll, and in the second stage they use the captured energy to convert carbon dioxide and water into oxygen and sugars. Plants take in carbon dioxide through pores called stomata and water through their roots, and the chemical reaction takes place inside the chloroplasts using energy from sunlight to produce oxygen as a byproduct and sugars that the plant stores as food.