The compositions of mixtures vary but compounds have constant definite composition. This is because all compounds follow the Law of Definite Proportions which states that all similar compounds will always have the same proportion of elements no matter where and how they are obtained. For example, carbon dioxide will always have 1 atom of carbon and 2 atoms of oxygen.