The amount realized on the sale of your home is the selling price minus selling expenses.
Per IRS Publication 523 Selling Your Home, within the worksheet on page 12:
2. Determine your selling expenses. These are the costs directly associated with selling your home.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.