Plants release oxygen as a by-product of photosynthesis, a process in which carbon dioxide is converted into sugar. The sugar is then used as an energy source for the plant.
When oxygen is produced through photosynthesis, it is released by the plant into the atmosphere. The sugars produced by photosynthesis are utilized by combining them with oxygen through a process called oxidation. Photosynthesis chemically converts sunlight into energy after being collected by special cells in their leaves known as chloroplasts. When a plant is deprived of sunlight, it may access its stored sugars and convert them into energy through the use of collected oxygen while releasing carbon dioxide in small amounts through respiration.