The formal charge assigned to an atom is calculated by subtracting the number of electrons the atom owns from the total number of electrons. The number of electrons owned by a specific atom is defined as being the sum of the valence electrons and half the valence electrons.