Formal charge and oxidation state both assign a number to each individual atom within a compound; they are compared and contrasted in a section below.
The formal charge system is just a method to keep track of all of the valence electrons that each atom brings with it when the molecule is formed.
This difference in practice stems from the relatively straightforward assignment of bond order, valence electron count, and hence, formal charge for compounds only containing main-group elements (though oligomeric compounds like organolithium reagents and enolates tend to be depicted in an oversimplified and idealized manner), but transition metals have an unclear number of valence electrons so there is no unambiguous way to assign formal charges.
[1][2] The concept of oxidation states constitutes a competing method to assess the distribution of electrons in molecules.
If the formal charges and oxidation states of the atoms in carbon dioxide are compared, the following values are arrived at: The reason for the difference between these values is that formal charges and oxidation states represent fundamentally different ways of looking at the distribution of electrons amongst the atoms in the molecule.
The formal charge view of the CO2 molecule is essentially shown below: The covalent (sharing) aspect of the bonding is overemphasized in the use of formal charges since in reality there is a higher electron density around the oxygen atoms due to their higher electronegativity compared to the carbon atom.
The inadequacy of the simple Lewis structure view of molecules led to the development of the more generally applicable and accurate valence bond theory of Slater, Pauling, et al., and henceforth the molecular orbital theory developed by Mulliken and Hund.