IRC §121, “Exclusion of gain from sale of principal residence” allows homeowners to exclude up to $250,000 of capital gains from the sale of their principal residence from their taxable income. For married couples filing jointly, this exclusion increases to $500,000. Any gain exceeding these amounts is subject to capital gains tax, which varies based on your income bracket, typically 0%, 15%, or 20%. Properly documenting home improvements and selling expenses can help reduce your taxable gain.
More details are covered in section “Selling Houses”.