Deductions & credits

The IRS discusses this in publication 523.

https://www.irs.gov/forms-pubs/about-publication-523

 

For the cost basis, you can add the costs of the purchase transaction that were not deductible at the time, like surveys, mortgage recording fees, county transfer tax, attorney, mortgage application fees and so on.  

 

When you sell, you report the sales price, but there is also a place on the form to report selling expenses.  That would include your real estate commission, attorney, and any transactional costs like surveys or inspections you were required to make.  You can't deduct anything that represents a change to the home.  For example, you can subtract staging costs, if you paid someone to rent furnishings and stage the home.  But if the inspection revealed problems that you had to repair as a condition of selling, those repairs are not selling price adjustments since repairs to personal property you own are never deductible--you're supposed to keep your property in good shape anyway.