A molecule consists of at least two atoms of the same element, while a compound includes at least two elements. An example of a molecule would be molecular hydrogen, which has two atoms of hydrogen and is represented as H2. An example of a compound would be water (H2O), which has two atoms of hydrogen and one atom of oxygen.
Compounds includes molecules within them. For example, the hydrogen in water is a molecule because there are at least two atoms of the element; oxygen, however, would not be a molecule on its own since there's only one atom of it. Some other examples of molecules include molecular nitrogen (N2) and molecular oxygen (O2), and some other compounds include methane (CH4) and carbon dioxide (CO2).