Why does magnesium oxide have no overall electric charge?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

Magnesium oxide (MgO) has no overall electric charge because it is an ionic compound formed by the combination of oppositely charged ions in a ratio that results in a net zero charge.1

In this compound, a magnesium atom loses two electrons from its outermost shell to become a positively charged cation (Mg2+), while an oxygen atom gains those two electrons to become a negatively charged anion (O2−). Because the total number of electrons lost by the magnesium equals the total number of electrons gained by the oxygen, the positive and negative charges perfectly balance each other out. This electrostatic attraction between the Mg2+ and O2− ions holds the structure together as a stable, electrically neutral solid.12