Magnesium chloride (MgCl2) is an ionic compound composed of magnesium ions (Mg^2+) and chloride ions (Cl^-), forming a crystalline solid at room temperature. This compound exemplifies the principles of ionic bonding, where electrons are transferred from one atom to another, resulting in the formation of charged ions that attract each other due to electrostatic forces.