A little more information about your computer would help. Are you using the PRO or HOME version of Windows XP? WHY do you want to reformat and recover the computer? There may be something easier which will fix the issue. Have you tried running "System Restore" to an earlier time when the machine worked correctly?
What brand name is the computer? HP and Compaq have "Recovery Partitions" or CD's which allow you to simply run the recovery process and it will format and reinstall the factory programs.
Do you have the Windows XP CD that came with the computer? If so, then you might want to read the link below:
The more information you give us, the better informed our answer will be.
Hope this helps and let us know more.
how do i format my computer to get it back the way it was when i bought it