# How do you calculate formal charge of an atom?

The formal charge is the difference between $Z$, the atomic number of the atom, and the number of electrons, bonding and non-bonding, that surround that atom.
Our conception of formal charge goes back to the old idea that in a covalent bond, the electrons are shared. Where there is a lone pair, for instance on $N$ or $O$, the charge devolve solely to that atom,