Plants take in water through their roots and carbon dioxide through their leaves. Sunlight provides the energy for photosynthesis. During photosynthesis, plants convert water and carbon dioxide into glucose (sugar) for energy and growth, and release oxygen as a byproduct. Matter is transformed from simple inorganic molecules into complex organic molecules. Energy flows from the sun, is captured by the plant, and is stored in chemical bonds of glucose, with some energy lost as heat.