Chemiosmosis is the movement of ions across a semipermeable membrane bound structure, down their electrochemical gradient. An important example is the formation of adenosine triphosphate (ATP) by the movement of hydrogen ions (H) across a membrane during cellular respiration or photosynthesis.
Hydrogen ions, or protons, will diffuse from a region of high proton concentration to a region of lower proton concentration, and an electrochemical concentration gradient of protons across a membrane can be harnessed to make ATP. This process is related to osmosis, the movement of water across a selective membrane, which is why it is called "chemiosmosis".
ATP synthase is the enzyme that makes ATP by chemiosmosis. It allows protons to pass through the membrane and uses the free energy difference to convert phosphorylate adenosine diphosphate (ADP) into ATP. The ATP synthase contains two parts: CF0 (present in thylakoid membrane) and CF1 (protrudes on the outer surface of thylakoid membrane). The breakdown of the proton gradient leads to conformational change  in CF1—providing enough energy in the process to convert ADP to ATP. The generation of ATP by chemiosmosis occurs in mitochondria and chloroplasts, as well as in most bacteria and archaea. For instance, in chloroplasts during photosynthesis, an electron transport chain pumps H ions (protons) in the stroma (fluid) through the thylakoid membrane to the thylakoid spaces. The stored energy is used to photophosphorylate ADP, making ATP, as protons move through ATP synthase.