Photosynthesis is the process by which plants use sunlight, carbon dioxide and water to produce oxygen and energy in the form of glucose. It occurs through two stages - the light-dependent reactions where ATP and NADPH are produced, and the light-independent Calvin cycle where glucose is produced. All living organisms ultimately depend on photosynthesis, which takes place primarily in the chloroplasts of plant leaves using the pigments chlorophyll a and b. The rate of photosynthesis is affected by factors like light intensity, carbon dioxide concentration, temperature and water availability.