Short answer. Not as a deduction, but it does help. A new roof is a capital improvement, so its cost is added to your home's cost basis, which lowers the taxable gain when you sell. For many homeowners the home sale exclusion of up to $250,000 of gain, or $500,000 for married couples filing jointly, already covers the gain, so the roof matters most when your gain is larger than that.
How basis works
Your basis is roughly what you paid for the house plus the cost of improvements. Gain is the sale price, minus selling costs, minus basis. A $16,000 roof raises basis by $16,000, which reduces the gain by the same amount.
The home sale exclusion
If you owned and lived in the home as your main residence for at least two of the five years before the sale, you can generally exclude up to $250,000 of gain, or $500,000 for married couples filing jointly. Improvements like a roof matter when:
You have owned the home a long time in a rising market
You do not meet the two-year tests
The property was partly rented or used for business
What counts and what does not
Counts: a full replacement, a new layer of decking, added ventilation, gutters installed with the roof.
Does not count: repairs that keep the roof working, such as replacing a few shingles or a pipe boot.
If insurance paid for the roof
After a storm claim, the casualty rules adjust basis: insurance reimbursements reduce basis and the cost of restoring the property increases it. In practice, what you paid yourself is what usually adds value to your basis. Give your tax preparer the claim paperwork; IRS Publication 547 covers the details.
Keep the records
Keep the contract, final invoice, proof of payment and permit for as long as you own the home, plus several years after the sale return is filed.