Actually, a compound is a type of molecule. A molecule is formed when two or more atoms of an element chemically join together. If the types of atoms are different from each other, a compound is formed. but if all the atoms are same then an element is formed. Not all molecules are compounds, since some molecules, such as hydrogen gas or ozone, consist only of one element or type of atom and hence are molecules of elements.
Molecule Examples
H2O, O2 , O3
Compound Examples
NaCl, H2O
Element examples
H2, N2, O2, Cl2 etc.
OR
Molecule is the general term used to describe any atoms that are connected by chemical bonds. Every combination of atoms is a molecule. A compound is a molecule made of atoms from different elements. All compounds are molecules, but not all molecules are compounds. Hydrogen gas (H2) is a molecule, but not a compound because it is made of only one element. Water (H2O) can be called a molecule or a compound because it is made of hydrogen (H) and oxygen (O) atoms.