1031 Exchange Primary Residence
Know what the sale may trigger

Capital Gains When Selling A House

What determines whether you owe capital gains tax when selling a house, how the Section 121 exclusion works, and what changes if the home was ever a rental.

What this property or sale question changes

Most homeowners who sell the house they live in owe no federal tax at all, because Section 121 of the tax code excludes up to $250,000 of gain for a single filer, or $500,000 for a married couple filing jointly, on the sale of a principal residence. To qualify, you generally need to have owned and lived in the home as your main residence for at least two of the five years before the sale. Gain above the exclusion amount, or gain on a home that does not meet the test, is taxed at long-term capital gains rates if you held the property more than a year.

Your taxable gain is not your sale price minus your purchase price. It is your net sale proceeds, after selling costs like commissions and transfer taxes, minus your adjusted basis, which is your purchase price plus the cost of documented capital improvements over the years you owned the home.

What counts toward adjusted basis

Capital improvements that add value, extend useful life, or adapt the home to new uses count toward basis: a kitchen remodel, an addition, a new roof, replaced windows, a finished basement. Routine repairs and maintenance, like painting or fixing a leaky faucet, do not. Closing costs from your original purchase, such as title fees and transfer taxes you paid as the buyer, also add to basis.

Keeping receipts and permits for improvements over the years you own a home is the single most useful thing an owner can do before a sale, since undocumented improvements are difficult to substantiate to a preparer or, if ever needed, to the IRS.

The ownership-and-use test in practice

You need both ownership and use for at least two years out of the five years ending on the date of sale, and the two years do not need to be continuous. Short absences, such as a vacation or a temporary work assignment, generally still count as use. Longer gaps, like renting the home out for an extended period before selling, can create nonqualified use that reduces your available exclusion on a pro-rata basis for periods after 2008.

You can generally only claim the exclusion once every two years, so selling a second home shortly after a prior sale that used the exclusion may not qualify again yet.

Partial exclusions for a move before two years

If you sell before meeting the full two-year test because of a job change, a health issue, or certain other unforeseeable circumstances defined by the IRS, you may still qualify for a partial exclusion, prorated based on how much of the two-year period you actually satisfied. This is a factual determination, and the qualifying reasons are narrower than many sellers assume; a cross-country move for a better opportunity does not automatically qualify unless it meets the IRS's specific distance and circumstance tests.

IRS Publication 523 lays out the qualifying unforeseeable circumstances and the worksheet for calculating a partial exclusion.

If the house was ever rented or used for business

Any depreciation claimed while the home was rented out, or while a home office was deducted, is recaptured on sale at a rate up to 25 percent and is not excludable under Section 121, regardless of how the rest of the gain is treated. A home that spent meaningful time as a rental before becoming your primary residence again may also face reduced exclusion eligibility under the nonqualified-use rule.

These situations require pulling your actual depreciation records rather than estimating, since the recapture amount is calculated from what you actually deducted, not from an assumed schedule.

When the gain exceeds the exclusion

In higher-value markets, it is increasingly common for gain on a long-held primary residence to exceed the $250,000 or $500,000 exclusion limits, leaving a taxable balance even after the exclusion is applied. That remaining gain is taxed at ordinary long-term capital gains rates, and may also be subject to the 3.8 percent net investment income tax above certain income thresholds.

Because Section 1031 exchanges apply only to investment or business-use property, they are not available for the excess gain on a primary residence; that gain is simply taxable in the year of sale unless the home has a documented investment-use history that changes its classification.

What to clarify before acting on Capital Gains When Selling A House

What determines whether you owe capital gains tax when selling a house, how the Section 121 exclusion works, and what changes if the home was ever a rental. The practical review should begin before the property is listed or the closing calendar begins to control the available choices. An early review gives the owner time to correct missing records, compare a taxable sale with exchange treatment, define replacement criteria, and bring the right professionals into the transaction.

Gather purchase and closing records, capital improvements, selling expenses, depreciation schedules, ownership changes, inherited-property documents, debt, and expected net proceeds. Those records turn a broad question into a supportable property-use timeline and an actual estimate of sale proceeds. They also expose issues that generic calculators miss, including periods of mixed use, depreciation that must be accounted for, ownership changes, debt replacement, co-owner differences, and expenses that change adjusted basis.

A sale decision becomes clearer after calculating net proceeds, adjusted basis, eligible exclusions, depreciation recapture, state exposure, and the cost of every alternative. Gross sale price alone does not answer the tax question. The result should be a written set of priorities for the sale: the amount of liquidity needed, the income expected from replacement property, the level of control the owner wants, the management work the owner is willing to keep, and the risks that require additional diligence.

Use the 45-day window for decisions, not discovery.

When a 1031 exchange remains a viable path, define the acquisition brief before the relinquished property closes. Primary and backup candidates should be compared for price, debt, income, control, workload, inspections, insurance, financing, title, sponsor or tenant exposure, and the probability of closing on time. Waiting until identification begins often turns a deliberate strategy into a search for whatever happens to be available.

For the portion of a sale that involves prior rental use of the home, a DST can serve as passive 1031 replacement property once that qualifying investment portion is properly separated from the excluded primary-residence gain. Projected income is not guaranteed, private offerings can be illiquid, and sponsor-controlled investments require a complete review of offering documents, fees, conflicts, leverage, property risks, investor eligibility, and suitability through an appropriately licensed professional.

The next useful conversation connects this topic with the rest of the sale. Related questions may include the Section 121 home sale exclusion in detail, how a partial exclusion is calculated, converting a primary residence into a rental. Addressing those questions together helps the owner avoid solving one tax issue while creating an ownership, income, financing, or liquidity problem after closing.

Common questions

Frequently Asked Questions

Do I have to pay capital gains tax when I sell my house?

Only on gain above the Section 121 exclusion amount, which is $250,000 for a single filer or $500,000 for a married couple, assuming you meet the two-year ownership-and-use test.

How do I calculate my adjusted basis on a house?

Start with your original purchase price plus closing costs, then add the cost of documented capital improvements made over your ownership period.

Can I use the exclusion if I lived in the house for less than two years?

You may qualify for a partial exclusion if the sale was due to a job change, health issue, or another unforeseeable circumstance recognized by the IRS.

Is depreciation recapture owed on a primary residence?

Only if you claimed depreciation, typically because part of the home was rented out or used for a home office deduction during your ownership.

Can I do a 1031 exchange on my primary residence?

No. A 1031 exchange applies only to property held for investment or business use, not to a home used as your principal residence.