A compound refers to any substance that contains two or more elements that have been joined together chemically. All compounds are molecules; however, not all molecules are compounds. Molecules such as O2 or H2 are not considered compounds because they only contain a single element.
In order for a substance to be considered a compound, it will need to meet several key criteria. The first is that the elements that make up compound must be chemically combined. For instance, water is a compound made up a chemical bond between hydrogen and oxygen atoms, while pure table salt consists of a bond between sodium and chloride atoms.
Another important attribute of compounds is that the resultant substance comes with a new set of properties from the elements that made it. For instance, even though water is made from oxygen and hydrogen, its properties are not the same as either oxygen or hydrogen.
The composition of a compound comes with a fixed ratio of the combined elements. In the case of water, two atoms of hydrogen must be added to a single atom of oxygen to form water. Adding more oxygen atoms or fewer hydrogen atoms will result in a different type of compound.