When selling a primary residence, capital gains tax applies to the profit made, calculated by subtracting the adjusted basis from the sale price. The Internal Revenue Code Section 121 allows exclusion of up to $250,000 for single filers and $500,000 for married couples if the home was owned and used as a primary residence for at least two of the last five years. Partial exclusions may apply for job relocations, health reasons, or unforeseen events. Adjusted basis includes purchase price plus major improvements, reducing taxable gain.

