IRS allows a taxpayer to lower the sales price by the selling expenses before calculating gain. Normal expenses like real estate commission, title policy, attorney fees, and other sales expenses may be included if they are normal and customary.
Another significant adjustment is that capital improvements made during the holding period can be added to the cost basis. Normal maintenance like repairs are not considered improvements. IRS says that if the expenditure materially adds value (features) to the property, or appreciably prolongs the useful life of the property, or adapts a portion of the property to a new use, it can be considered a capital improvement.
Examples could include replacing a heating or air conditioning system, storm windows, new permanent landscaping like trees or shrubs or completing an unfinished basement. They don't necessarily have to be high-ticket items but can include things like adding dead bolts, ceiling fans, video doorbell and other items. For more information, see IRS Publication 523.
The total amount of the money that is spent on capital improvements increase the cost basis of the home which in turn will reduce the amount of gain when sold. With the average person staying in a home for 10 ... 12 years, the total improvements could be significant.
As an example, let's say a single taxpayer sold their home for $350,000 more than they paid for it. If their selling expenses were $25,000 and they had made $75,000 of capital improvements during the holding period, the gain would be $250,000 and within the limits for a single taxpayer to exclude all of it instead of having a $100,000 gain.
It is necessary to be able to prove the amount spent and for that reason, a routine should be established to keep the receipts and cancelled checks for all expenditures on their principal residence. Even if the owner is not sure whether they qualify as an improvement, by having the receipt available at the time of sale, a tax professional can help a homeowner with the determination.
In addition to receipts and cancelled checks, a contemporaneous register listing the date, description and amount spent will provide accurate information for calculations and serve as evidence should it be needed in the future.
There is more information in the Homeowners Tax Guide that is available for download.