When a molecule or ion is represented by a Lewis dot structure,the charge on an atom is called the formal charge. If an atom has more electrons than valence electrons,it has a negative formal charge,and if it has fewer electrons than valence electrons,it has a positive formal charge.
Calculation of formal charge is expressed by the following equation:
$F.C = (\text{Total number of valence electrons}) - (\text{Total number of non-bonding electrons}) - \frac{1}{2}(\text{Total number of bonding electrons})$
Note: Formal charge is not a real charge in a molecule,but it provides information about the position and arrangement of electrons.
Example: Formal charge of oxygen in an ozone molecule $(O_3)$.
The central $O$ atom marked $1$:
$F.C = (\text{Valence electron of neutral oxygen}) - (\text{Non-bonding electrons of } O_1) - \frac{1}{2}(\text{Bonding electrons of } O_1)$
$F.C = 6 - 2 - \frac{1}{2}(6) = +1$
The end $O$ atom marked $2$:
$F.C = (\text{Valence electron of } O) - (\text{Non-bonding electrons of } O_2) - \frac{1}{2}(\text{Bonding electrons of } O_2) = 6 - 4 - \frac{1}{2}(4) = 0$
The end $O$ atom marked $3$:
$F.C = (\text{Valence electron of } O) - (\text{Non-bonding electrons of } O_3) - \frac{1}{2}(\text{Bonding electrons of } O_3) = 6 - 6 - \frac{1}{2}(2) = -1$
Hence,the structure of $O_3$ with formal charges is indicated.