An ionic compound is a substance formed from the chemical binding of elements with opposite charges. The force of attraction between opposite charges keeps the molecule together. Common table salt, or sodium chloride, is an example of an ionic compound.
Elmhurst College's Virtual Chembook explains that the main players in ionic compounds are the ions, which are charged atoms. Atoms form ions because ions are usually more stable than the neutral atom. The most stable arrangement for an atom is to have eight valence electrons in its outermost energy level. Most elements on the periodic table do not have this electron configuration. Depending on how many valence electrons it has, an atom gains or loses electrons. Atoms that have relatively few valence electrons, such as metals, lose electrons and are electropositive. Atoms that contain six or seven valence electrons, such as nonmetals, attract more electrons and are electronegative. Once an atom gains or loses electrons, it possesses a charge and becomes an ion. Ions have different properties from the neutral forms of the atoms.
When an electropositive atom meets up with an electronegative atom, electrons jump from the electropositive to electronegative atom. Ions are then formed. An ionic bond is created between the positively charged and negatively charged ions. Ionic compounds contain repeating patterns of ions called crystal lattices.