Photosynthesis is the process by which plants, algae and many types of bacteria convert carbon dioxide into organic compounds, such as sugar by using the energy from sunlight. This sugar is glucose, which is their food. A common by-product of photosynthesis is oxygen, as both carbon dioxide and water are needed for this process to occur.