Photosynthesis is the process by which plants, algae, and some bacteria use sunlight, water, and carbon dioxide to produce oxygen and energy in the form of ATP and NADPH. This energy is then used to synthesize carbohydrates from carbon dioxide and water. The light reactions use energy from sunlight to produce ATP and NADPH, which are then consumed in the Calvin cycle to fix carbon from carbon dioxide into organic molecules like glucose. The light reactions take place in the thylakoid membranes of chloroplasts and involve the absorption of light by chlorophyll and the transfer of electrons to generate a proton gradient used to produce ATP via chemiosmosis.