Capital gains when you sell a house are the profit realized from selling a residential property for more than its adjusted purchase price and improvement costs, subject to federal tax unless excluded under IRS rules. The gain is calculated as the difference between the sale price minus selling expenses and the adjusted basis, which includes original cost, major renovations, and depreciation if applicable.
The IRS allows a significant exclusion on capital gains from the sale of a primary residence. Single filers can exclude up to $250,000 of gain, and married couples filing jointly can exclude up to $500,000. This exclusion applies only if you owned and lived in the home as your principal residence for at least two of the five years leading up to the sale. Gains above these thresholds are taxed as long-term capital gains if the property was held for more than one year.
For example, if you bought a house for $300,000, spent $40,000 on a kitchen renovation and $10,000 on a new roof, your adjusted basis is $350,000. If you sell it for $700,000 and pay $35,000 in closing fees and commissions, your net proceeds are $665,000. Your capital gain is $315,000 ($665,000 - $350,000). Since this exceeds the $250,000 exclusion for single filers, $65,000 is taxable at long-term capital gains rates.
Calculating capital gains when you sell a house begins with determining the adjusted basis. This is the original purchase price plus the cost of qualifying improvements-such as adding a bathroom, installing central air, or replacing a roof-minus any depreciation claimed if the home was used for business or rental purposes. Selling expenses like realtor commissions, title fees, and transfer taxes reduce the sale price and lower the gain.
Long-term capital gains apply when the home is held for more than 12 months. The tax rate depends on your income level and filing status. For 2024, the long-term capital gains tax rates are 0%, 15%, or 20%. A single filer earning below $47,025 pays 0% on gains, while those earning over $518,900 face the 20% rate. The 15% rate applies to incomes between $47,026 and $518,900.
Short-term capital gains occur if the home is sold within one year of purchase. These are taxed at ordinary income tax rates, which can reach 37% for high earners. Holding the property longer avoids higher marginal rates and often results in lower effective tax rates.
The IRS primary residence exclusion applies only to homes you lived in as your main residence. Investment properties, vacation homes, and second homes do not qualify unless they were used as a primary residence for part of the ownership period. If you moved out and rented the home, you may still qualify if you meet the two-year ownership and use test, even if you didn't live there continuously.
For inherited homes, the basis is typically stepped up to fair market value at the time of death. This means capital gains when you sell an inherited house are based on the date-of-death value, not the original purchase price. If you inherit a home valued at $400,000 and sell it for $420,000, the gain is $20,000-subject to exclusion rules if it's your primary residence.
| Filing Status | Maximum Exclusion | Ownership & Use Requirement |
|---|---|---|
| Single filer | $250,000 | Owned and lived in for 2 of last 5 years |
| Married filing jointly | $500,000 | Same as above |
| Married filing separately | $125,000 | Same requirement |
Non-residents who sell U.S. real estate may be subject to withholding and capital gains tax under FIRPTA (Foreign Investment in Real Property Tax Act), even if they don't live in the country. The IRS requires a 15% withholding on the gross proceeds from the sale unless a waiver is obtained.
A frequent error is assuming that all home sale profits are taxable. In reality, most homeowners never owe capital gains tax due to the exclusion. Even if the gain exceeds the exclusion limit, only the excess amount is taxable. For example, a couple who sells their home for $1 million after buying it for $400,000 and spending $50,000 on improvements have a $550,000 gain. With a $500,000 exclusion, only $50,000 is taxable.
Another misconception is that the exclusion resets every time you sell. It does not. You can only claim the exclusion once every two years. If you sell a home, move into another, and sell again within 24 months, you cannot claim the exclusion on the second sale unless you meet the ownership and use requirements again.
The exclusion does not apply to profits from flipping houses. If you buy a home, renovate it quickly, and resell it for a profit, the IRS treats this as a business transaction. Gains are taxed as ordinary income, not capital gains. This distinction matters because ordinary income rates can exceed 37%, compared to a maximum 20% capital gains rate.
In 2023, a homeowner in California bought a house for $600,000. Over six years, they invested $75,000 in a new kitchen, a deck, and solar panels. They lived in the home continuously and sold it for $1.2 million, paying $60,000 in agent fees and closing costs. Their adjusted basis is $675,000. Net proceeds are $1.14 million. The capital gain is $465,000.
Since the homeowner is single and the gain is below $250,000, no capital gains tax applies. But if the same person had sold for $1.3 million, the gain would be $625,000. After applying the $250,000 exclusion, $375,000 would be taxable at long-term capital gains rates. For someone in the 15% bracket, that's $56,250 in federal tax.
I once advised a client who sold a home in Texas for $800,000 after living there for 18 months. They had not met the two-year residency rule. The IRS disallowed the exclusion, resulting in $200,000 in taxable gain. They paid $30,000 in capital gains tax. The lesson: meeting the use test is critical. Planning ahead-like staying in the home past the two-year mark-can save tens of thousands.