Get your taxes done using TurboTax

"If I make house improvements in the year I sell - do I add those house improvement costs to the cost basis to reduce taxability" answer is yes

 

NII includes

1) rents and income unless derived in the ordinary course of a trade or business that is not a passive activity

2) net gain attributable to the disposition of property other than property held in a nonpassive trade or business. However, gain or loss from the sale of property held in a trade or business in which the taxpayer materially participates is not NII 

examples of 2) gain from the sale of investment real estate and gain from sale of residence in excess of the applicable exclusion. Gain includes depreciation recapture. 

 

The NIIT tax is computed on the lower of NII or modified AGI in excess of the exclusion for your filing status.

 

you do have the option of doing a 1031 exchange (assuming it's not your home) to avoid the NIIT. This should be discussed with a tax pro so if it's done it's done properly.