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 glucose. It occurs in two stages: the light-dependent reactions where light energy is captured and used to produce ATP and NADPH, and the light-independent reactions where CO2 is incorporated into organic compounds to produce glucose. Photosynthesis is essential as it produces oxygen and glucose, the primary energy source for nearly all life on Earth.