The origin of chloroplasts is now largely accepted by the botany community as occurring via endosymbiosis on an ancestral basis with the engulfment of photosynthetic bacterium within the eukaryotic cell. Over millions of years the endosymbiotic cyanobacterium evolved structurally and functionally, retaining its own DNA and the ability to divide by binary fission (not mitotically) but giving up its autonomy by the transfer of some of its genes to the nuclear genome.

Within the envelope membranes, in the region called the stroma, there is a system of interconnecting flattened membrane compartments, called the thylakoids. The thylakoid membrane is quite similar in lipid composition to the inner envelope membrane, containing 78% galactolipids, 15.5% phospholipids and 6.5% sulfolipids in spinach chloroplasts.[2] The thylakoid membrane encloses a single, continuous aqueous compartment called the thylakoid lumen.[6]

These are the sites of light absorption and ATP synthesis, and contain many proteins, including those involved in the electron transport chain. Photosynthetic pigments such as chlorophylls a,b and c some others, e.g., xanthophylls, carotenoids, phycobilins are also embedded within the granum membrane. With exception of chlorophyll a, all the other associated pigments are "accessory" and transfer energy to the reaction centers, Photosytems I and II.

The membranes of the thylakoid contain photosystems I and II which harvest solar energy to excite electrons which travel down the electron transport chain. This exergonic fall in potential energy along the way is used to draw (not pump!) H+ ions from the lumen of the thylakoid into the cytosol of a cyanobacterium or the stroma of a chloroplast. A steep H+ gradient is formed, which allows chemiosmosis to occur, where the thylakoid, transmenbrane ATP-synthase serves a dual function as a "gate" or channel for H+ ions and a catalytic site for the formation of ATP from ADP + a PO43− ion.

Experiments have shown that the pH within the stroma is about 7.8, while that of the lumen of the thylakoid is 5. This corresponds to a six-hundredfold difference in concentration of H+ ions. The H+ ions pass down through the ATP-synthase catalytic gate. This chemiosmotic phenomenon occurs in mitochondria.