Open up Firefox
Click on Bookmarks
Select Manage Bookmarks from the drop down menu
On the pop-up window that appears, click on File >> Export
Browse to where you want the bookmarks to go, name the file or leave it as its default of bookmarks.html and click on Save.
When you're ready to import them after your format and clean install, repeat the above steps but select the option to Import instead. Browse to your bookmarks.html file and off you go.
Job Done !