The main difference between a covalent compound and an ionic compound is the type of elements used. In a covalent compound, a nonmetal bonds with another nonmetal (e.g. H20, NH3, CH4).
In an ionic compound, a metal bonds with a nonmetal (e.g.NaCl, KCl, MgCl2). What makes an ionic compound binary is the amount of atoms used. This includes any ionic compounds that has two atoms such as NaCl and KCl.
Note that although MgCl2 has two elements, it does not have the same amount of atoms. Mg is one atom and Cl has a subscript of 2 which makes chlorine have two atoms.
Hope this helps!!!