Count the book's number of pages. This includes the body of the book as well as front and back matter like the dedication page, acknowledgments, index, and about the author page. Do your calculation after your book has been formatted into its final format so you can get an accurate page count.
Determine the thickness of the paper. Call your book printer to ask for this information or look at the estimate or quote they provided to you.
Divide the total number of pages by the paper's thickness. Paper thickness is measured in "pages per inch" (PPI). If the book has 200 pages and the PPI is 400, the book's spine width is 200/400, which is half an inch.
Allow more room if the book is a hardcover. The extra room accommodates for the book jacket and the hardcover boards. The Complete Guide to Self-Publishing recommends asking your printer for a template. If you calculate this wrong, printing could be delayed.