There are four types of compounds, depending on how the constituent atoms are held together:
- molecules held together by covalent bonds
- ionic compounds held together by ionic bonds
- intermetallic compounds held together by metallic bonds
- certain complexes held together by coordinate covalent bonds.
A chemical formula is a way of expressing information about the proportions of atoms that constitute a particular chemical compound, using the standard abbreviations for the chemical elements, and subscripts to indicate the number of atoms involved. For example, water is composed of two hydrogen atoms bonded to one oxygen atom: the chemical formula is H 2 O.
A compound can be converted to a different chemical composition by interaction with a second chemical compound via a chemical reaction. In this process, bonds between atoms are broken in both of the interacting compounds, and then bonds are reformed so that new associations are made between atoms. Schematically, this reaction could be described as AB + CD → AD + CB, where A, B, C, and D are each unique atoms; and AB, AD, CD, and CB are each unique compounds.
A chemical element bonded to an identical chemical element is not a chemical compound since only one element, not two different elements, is involved. Examples are the diatomic molecule hydrogen (H 2 ) and the polyatomic molecule sulfur (S 8 ).
Any substance consisting of two or more different types of atoms (chemical elements) in a fixed stoichiometric proportion can be termed a chemical compound; the concept is most readily understood when considering pure chemical substances. :15   It follows from their being composed of fixed proportions of two or more types of atoms that chemical compounds can be converted, via chemical reaction, into compounds or substances each having fewer atoms. The ratio of each element in the compound is expressed in a ratio in its chemical formula.  In the case of non-stoichiometric compounds, the proportions may be reproducible with regard to their preparation, and give fixed proportions of their component elements, but proportions that are not integral [e.g., for palladium hydride, PdH x (0.02 < x < 0.58)].  Chemical compounds have a unique and defined chemical structure held together in a defined spatial arrangement by chemical bonds. Chemical compounds can be molecular compounds held together by covalent bonds, salts held together by ionic bonds, intermetallic compounds held together by metallic bonds, or the subset of chemical complexes that are held together by coordinate covalent bonds. Pure chemical elements are generally not considered chemical compounds, failing the two or more atom requirement, though they often consist of molecules composed of multiple atoms (such as in the diatomic molecule H 2 , or the polyatomic molecule S 8 , etc.).
There is varying and sometimes inconsistent nomenclature differentiating substances, which include truly non-stoichiometric examples, from chemical compounds, which require the fixed ratios.
Bonding and forces
Compounds are held together through a variety of different types of bonding and forces.
London dispersion forces are the weakest force of all intermolecular forces. They are temporary attractive forces that form when the electrons in two adjacent atoms are positioned so that they create a temporary dipole. Additionally, London dispersion forces are responsible for condensing non polar substances to liquids, and to further freeze to a solid state dependent on how low the temperature of the environment is. 
A covalent bond, also known as a molecular bond, involves the sharing of electrons between two atoms. Primarily, this type of bond occurs between elements that fall close to each other on the periodic table of elements, yet it is observed between some metals and nonmetals. This is due to the mechanism of this type of bond. Elements that fall close to each other on the periodic table tend to have similar electronegativities, which means they have a similar affinity for electrons. Since neither element has a stronger affinity to donate or gain electrons, it causes the elements to share electrons so both elements have a more stable octet.
Ionic bonding occurs when valence electrons are completely transferred between elements. Opposite to covalent bonding, this chemical bond creates two oppositely charged ions. The metals in ionic bonding usually lose their valence electrons, becoming a positively charged cation. The nonmetal will gain the electrons from the metal, making the nonmetal a negatively charged anion. As outlined, ionic bonds occur between an electron donor, usually a metal, and an electron acceptor, which tends to be a nonmetal. 
Hydrogen bonding occurs when a hydrogen atom bonded to an electronegative atom forms an electrostatic connection with another electronegative atom through interacting dipoles or charges.