Photosynthesis allows plants, algae and certain bacteria to turn sunlight into chemical energy. The amazing feat is achieved because sunlight can fuel a reaction between water and carbon dioxide that, in turn, produces carbohydrates (simple sugars) and oxygen.
Hope this helped