Formula from Chapter 7: Definition of formal charge
\(\mathrm{charge}_{\mathrm{formal}} = ⋕e_{\mathrm{outer\ freeatom}} - ⋕e_{\mathrm{lonepairs}} - \dfrac{1}{2} \cdot ⋕e_{\mathrm{bonding}}\)
For the carbon in carbondioxide with the following Lewis structure
\(⋕e_{\mathrm{outer\ freeatom}}\) \(= 4\)
\(⋕e_{\mathrm{lonepairs}}\) \(= 0\)
\(⋕e_{\mathrm{bonding}}\) \(= 8\)
\(\mathrm{charge}_{\mathrm{formal}}\) \(= ⋕e_{\mathrm{outer\ freeatom}} - ⋕e_{\mathrm{lonepairs}} - \dfrac{1}{2} \cdot ⋕e_{\mathrm{bonding}}\)
\(\ \ \ =4 - 0 - \dfrac{1}{2} \cdot 8\)
\(\ \ \ =4 - \frac{1 }{ 2} \cdot 8\)
\(\ \ \ =4 - 4\)
\(\ \ \ =0.0000000000000000\)