Home›Money›Capital Gains Tax on Real Estate and Property Sales

Capital Gains Tax on Real Estate and Property Sales

Selling a home or rental property mixes three tax rules: the home-sale exclusion of $250,000 single and $500,000 joint, depreciation recapture taxed at up to 25%, and the capital gains rates on the rest. This guide works each rule, with basis, the ownership and use tests, and the rental-versus-primary-home differences, and notes the like-kind exchange for investment property.

14 min readUpdated October 2026Capital Gains Tax Calculator

A property sale is the largest capital gain most people ever realise, and it is taxed under three rules at once: the home-sale exclusion that can remove $250,000 or $500,000 of gain from tax, the depreciation recapture rule that taxes part of a rental gain at up to 25%, and the ordinary capital gains rates on whatever remains. This guide explains each rule, how basis is built from purchase price and improvements, the ownership and use tests, the differences between a primary home and a rental, and the like-kind exchange that defers gain on investment property.

Key takeaways
  • The Section 121 home-sale exclusion removes up to $250,000 of gain for single filers and $500,000 for joint filers on a primary home, if the ownership and use tests are met: owned and used as the main home for at least 2 of the last 5 years.
  • The exclusion is generally available only once every 2 years, with partial exclusions for moves caused by work, health, or unforeseen circumstances.
  • Depreciation claimed on rental property is recaptured as unrecaptured Section 1250 gain taxed at up to 25%, and depreciation reduces basis, so it increases the gain even where the exclusion does not apply.
  • A like-kind exchange under Section 1031 defers gain on investment real property exchanged for like-kind real property, with a 45-day identification window and a 180-day exchange window, and it does not apply to a primary home.

The home-sale exclusion: $250,000 and $500,000

Section 121 of the tax code excludes from income up to $250,000 of gain on the sale of a principal residence for a single filer, and up to $500,000 for married couples filing jointly, provided the ownership and use tests are met. The exclusion applies to the gain, not to the sale price: a single filer who sells a home for $600,000 with a basis of $300,000 has a gain of $300,000, excludes $250,000, and is taxed on the remaining $50,000 at the capital gains rates, subject to the stacking and thresholds in the calculation guide. A joint-filing couple with the same figures excludes the full $300,000 and owes no federal tax on the gain, before state tax and the net investment income tax, which follow their own rules and do not share the exclusion. The exclusion is the largest single tax benefit available to most homeowners, and it is the reason a primary home is the most tax-favoured investment most people hold: the gain is sheltered up to the limit, the mortgage interest was deductible within its own limits, and the property taxes were deductible within theirs.

The exclusion amounts are fixed by statute and are not indexed for inflation, so they have lost real value since they were set in 1997, and proposals to raise them recur without having been enacted as of the build date. A home bought for $300,000 in a market that has doubled is likely to exceed the exclusion, and the excess is taxed, which is why long-held homes in high-growth markets produce taxable gains despite the exclusion. The exclusion applies per sale, not per lifetime, and it can be used repeatedly, subject to the two-year rule below, so a homeowner who sells, buys, and sells again can exclude gain on each sale that qualifies. The exclusion is claimed on the return, not through withholding or a form filed at closing, and a sale that qualifies fully and requires no reporting may not need to be reported at all, although the closing statement and the basis records should be kept in case the return is examined.

Gain above the exclusion is taxed as a long-term capital gain in most cases, since a home is usually held for more than a year, at the 0%, 15%, and 20% rates with the stacking rule, plus the net investment income tax where it applies. A home held for one year or less produces a short-term gain on the excess, taxed as ordinary income, and the exclusion itself still applies where the tests are met, which for a short holding period will usually mean the tests are not met, since the use test requires two years. A home sold at a loss produces a nondeductible personal loss, not a capital loss, because a principal residence is a personal-use asset, and the loss cannot offset other gains. The asymmetry, gains sheltered up to the limit and losses disallowed, is the tax code’s treatment of personal housing, and it should be understood before a sale that is expected to lose money is characterised as an investment.

The ownership and use tests

Both tests look at the five years ending on the sale date, and both require at least two years, 24 months or 730 days, within that window. The ownership test requires that the taxpayer owned the home for at least two of the last five years, and the use test requires that the taxpayer used it as a principal residence for at least two of the last five years. The two years need not be continuous, and they need not be the same two years: a taxpayer who owned a home for five years, lived in it for the first two, rented it for two, and lived in it again for the last year meets both tests, with three years of use and five of ownership. Short temporary absences, vacations and short business trips, count as use, and a taxpayer who becomes physically or mentally unable to care for themselves and moves to a care facility can treat the absence as use for up to five years, under the health exception. The tests are applied per taxpayer, so a married couple filing jointly can meet them with one spouse satisfying the ownership test and either spouse satisfying the use test, although both spouses must meet the use test for the full $500,000 exclusion in some cases involving a spouse’s prior sale.

Ownership and use are distinct, and the distinction matters for inherited homes, homes owned through a trust, and homes bought with a partner. An heir who inherits a home receives a stepped-up basis and is generally treated as meeting the ownership and use tests through the decedent in defined circumstances, and a home owned by a revocable trust is generally treated as owned by the grantor. A home owned jointly by unmarried partners is tested per owner, and each owner’s share of the gain is tested against that owner’s exclusion, so a $250,000 exclusion applies per qualifying owner, not per property. A home that was acquired in a like-kind exchange has a special rule: the ownership period includes the exchanged property’s period, but the exclusion cannot be claimed within five years of the exchange. The IRS publication on selling a home, Publication 523, works the tests with examples for the common variations, and it should be consulted for any case that is not a straightforward single-owner, long-residence sale.

Partial exclusions and the two-year rule

The exclusion is generally available only once every two years, measured from the closing date of the prior sale for which the exclusion was claimed. A taxpayer who excluded gain on a sale in June 2024 cannot exclude gain on another sale until June 2026, and a sale inside the two-year window produces a fully taxable gain, subject to the partial exclusion below. The two-year rule applies to the exclusion, not to the sale: a taxpayer can sell as often as they like, but only one sale in two years can carry the exclusion. A taxpayer who sold a home and did not claim the exclusion, because the gain was small or the return did not need it, has not used the exclusion for the two-year rule, and the prior sale does not block a later one, although the facts should be documented.

A partial exclusion is available where the sale is caused by a change in place of employment, health reasons, or unforeseen circumstances, even if the tests or the two-year rule are not fully met. The partial exclusion is the full exclusion amount multiplied by the fraction of the test period satisfied, so a taxpayer who owned and used a home for 12 months and sold because of a qualifying job move can exclude half of the $250,000 or $500,000 limit, $125,000 or $250,000, subject to the gain. Qualifying job moves generally require the new workplace to be at least 50 miles farther from the home than the old workplace was, health reasons require a physician’s recommendation or a qualifying medical condition, and unforeseen circumstances include death, divorce, separation, multiple births, job loss, and other events the regulations list, including natural disasters and certain financial hardships. The partial exclusion is claimed in the same way as the full exclusion, with the reason documented, and Publication 523 lists the qualifying circumstances and the distance test in detail.

Basis: what the gain is measured from

Basis for a home is the purchase price, including the costs of acquiring it that are properly capitalised, such as transfer taxes, title insurance, and legal fees for the purchase, plus the cost of improvements that add value, prolong life, or adapt the property to a new use, minus depreciation claimed or claimable and minus any casualty losses deducted or insurance reimbursements. Improvements include additions, a new roof, a new heating system, rewiring, paving, and landscaping that is a permanent improvement, while repairs that merely maintain the property in its current condition, such as repainting, fixing a leak, or replacing a broken window, generally do not add to basis. The distinction between an improvement and a repair is the most consequential basis question for a long-held home, because a lifetime of improvements can add tens of thousands to basis and remove the same amount from the gain, while a lifetime of repairs adds nothing. Keep the receipts, contracts, and permits for improvements, separated from repair receipts, for the whole ownership period, since the gain cannot be recomputed after the records are gone.

Selling costs reduce the amount realised, which has the same effect as increasing basis: brokerage commissions, title and escrow fees on the sale, transfer taxes, and legal fees for the sale are subtracted from the sale price before the gain is computed. Points and loan costs are generally not selling costs, and the mortgage balance does not enter the gain calculation at all: a home sold for $500,000 with a $400,000 mortgage and a $300,000 basis produces a $200,000 gain, and the mortgage is repaid from the proceeds without affecting the tax. Energy credits, casualty loss deductions, and prior exclusion claims can adjust basis or the exclusion available, and a home that was ever used as a rental or a home office carries depreciation and allocation adjustments, covered in the rental section. The worked example that follows uses the basis rules directly: a home bought for $280,000, improved by $45,000, sold for $520,000 with $25,000 of selling costs, has an amount realised of $495,000, a basis of $325,000, and a gain of $170,000, which a single filer excludes entirely under the $250,000 limit, and a joint-filing couple excludes entirely with room to spare.

Depreciation recapture at up to 25%

Depreciation claimed on real property, or that could have been claimed, reduces basis and is recaptured on sale as unrecaptured Section 1250 gain, taxed at a maximum rate of 25%, rather than the 0%, 15%, or 20% long-term rates. The recapture applies to the depreciation attributable to the property, up to the gain, and it applies whether or not the taxpayer actually claimed the depreciation, since the basis reduction follows the depreciation allowable, not only the depreciation taken. A rental property bought for $300,000, depreciated by $80,000 over the holding period, and sold for $450,000 with $20,000 of selling costs has an amount realised of $430,000, a basis of $220,000, and a gain of $210,000, of which $80,000 is unrecaptured Section 1250 gain taxed at up to 25%, and $130,000 is adjusted net capital gain taxed at the preferential rates. The 25% rate is a maximum: the recapture gain fills the preferential brackets in the same stacking order, and at lower incomes it is taxed below 25%, so the 25% figure is the cap, not a flat rate.

Depreciation recapture is not reduced by the home-sale exclusion where the exclusion does not apply, and where the exclusion does apply to a home that was partly depreciated, such as a home office or a period of rental use, the recapture portion attributable to depreciation after May 1997 is generally not excludable and remains taxable, even though the rest of the gain is excluded. The allocation between the excluded portion and the recapture portion follows the periods and areas of use, and the records of depreciation claimed, including the tax returns for the rental or home-office years, are the evidence. A taxpayer who never claimed depreciation on a rental, perhaps because the property was thought to be personal use, still faces the basis reduction for depreciation allowable, and the recapture on sale, which is why the depreciation decision should be made deliberately each year and recorded, rather than discovered at the sale.

Rental property versus a primary home

A rental property receives no home-sale exclusion, its gain is taxed at the capital gains rates with the recapture rule, and its losses are subject to the passive activity and at-risk rules, which can defer losses that exceed passive income. A primary home receives the exclusion and its losses are nondeductible. A property that changes use, a home converted to a rental or a rental converted to a home, is tested by the periods of each use, with the exclusion available for the home-use portion where the ownership and use tests are met for the qualifying period, and the gain allocated between the qualifying and non-qualifying use, under the rules that allocate gain where the property was used for non-qualified purposes after 2008. The allocation is done by the ratio of non-qualified use days to total ownership days, and the non-qualified portion of the gain is taxable even where the exclusion would otherwise shelter it. A home rented for three of ten years of ownership, then lived in for two and sold, will have part of its gain excluded and part taxed, with the recapture portion taxed separately, and the calculation needs the use history day by day.

Vacation homes sit between the two categories: a second home used personally is a personal-use asset, its gain is taxable without the exclusion unless it becomes the principal residence and meets the tests, and its rental use, where it is rented for more than 14 days a year, brings the vacation-home rules that allocate expenses between personal and rental use. A home office inside a principal residence, where depreciation was claimed on the office portion, produces recapture on that portion on sale, while the rest of the gain is excludable, and the office portion’s basis and depreciation must be tracked separately. The common thread is allocation: mixed-use property is divided by time and area, each part follows its own rule, and the records of use, depreciation, and expenses decide the division. Mixed-use sales are the cases most worth taking to a tax professional, because the allocation rules are detailed and the dollars are large.

Like-kind exchanges: deferring the gain

Section 1031 allows the gain on investment real property to be deferred where the property is exchanged for like-kind real property held for investment or business use, rather than sold for cash. Like-kind for real property is broad: an apartment building can be exchanged for farmland, a retail building for an office building, and unimproved land for improved property, because the standard is the nature and character of the property, not its grade or quality. The exchange must be structured as an exchange, generally through a qualified intermediary who holds the sale proceeds, because the taxpayer cannot touch the cash without recognising the gain. The replacement property must be identified within 45 days of the sale of the relinquished property, and the exchange must be completed within 180 days, or the due date of the return, whichever is earlier, and the deadlines are strict, with limited extensions for federally declared disasters. Cash or other non-like-kind property received, called boot, is taxed up to the gain, and debt relief is treated as boot, so a fully deferred exchange requires equal or greater debt on the replacement property.

Since the Tax Cuts and Jobs Act, Section 1031 applies only to real property: exchanges of personal property, vehicles, equipment, and collectibles no longer qualify, and the prior law’s broader scope should not be relied on. A primary home does not qualify, because it is not held for investment or business use, although a property that is partly rental and partly personal can be exchanged for the rental portion with allocation. The deferred gain carries into the replacement property’s basis, which is the relinquished property’s basis adjusted for boot and expenses, so the tax is deferred, not forgiven, and it will be recognised on a later taxable sale, unless the replacement property is held until death and receives a step-up. Exchanges are reported on Form 8824, and the intermediary, identification, and timing rules should be arranged before the sale closes, since an exchange attempted after the proceeds are received has already failed.

Reporting, instalment sales, and state tax

Property sales are reported on Form 8949 and Schedule D, with the exclusion claimed on the worksheet and the recapture computed through the unrecaptured Section 1250 worksheet, and an exchange is reported on Form 8824. Brokers and title companies report the sale on Form 1099-S, and the taxpayer remains responsible for the basis and the exclusion, which the 1099-S does not show. An instalment sale, where the seller finances the buyer’s purchase and receives payments over more than one year, spreads the gain across the years payments are received, in proportion to the gross profit percentage, which restarts the brackets and the net investment income tax threshold each year, and which defers the tax on the unpaid balance, with interest charged on deferred tax for large sales. The instalment method is not available for dealer dispositions or for sales of publicly traded property, and a related-party instalment sale carries resale rules that can accelerate the gain. State tax on a property sale is separate: the state where the property sits taxes the gain under its own rules, and the state of residence may also tax it, with a credit for tax paid to the other state, so a sale of property in one state by a resident of another needs both states’ returns. Other countries tax property gains under their own systems: Australia generally gives individuals a 50% discount on capital gains on assets held more than 12 months, and Canada generally includes 50% of a capital gain in income, each subject to its own conditions and residence rules, and neither figure should be used for a United States return. Keep the closing statements, the basis records, and the use history, and model the sale in the calculator before the closing date, when the structure can still be changed.

Frequently asked questions

How much capital gains tax do you pay when selling a house?

On a primary home, up to $250,000 of gain is excluded for single filers and $500,000 for joint filers if the ownership and use tests are met. Gain above the exclusion is taxed at the long-term rates of 0%, 15%, or 20%, plus the NIIT and state tax where they apply.

What are the ownership and use tests for the home-sale exclusion?

The taxpayer must have owned the home and used it as a principal residence for at least 2 of the last 5 years ending on the sale date. The periods need not be continuous or the same, and short absences count as use.

Can you use the home-sale exclusion more than once?

Yes, but generally only once every 2 years. A partial exclusion is available for sales caused by a job change, health reasons, or unforeseen circumstances, even if the tests or the two-year rule are not fully met.

What is depreciation recapture on rental property?

Depreciation claimed or allowable reduces basis and is recaptured on sale as unrecaptured Section 1250 gain, taxed at up to 25%, while the remaining gain is taxed at the preferential rates. The recapture applies even if the depreciation was never claimed.

Does a like-kind exchange avoid capital gains tax?

It defers it. Section 1031 defers gain on investment real property exchanged for like-kind real property, with 45-day identification and 180-day completion deadlines. The gain carries into the replacement property basis and is taxed on a later sale. It does not apply to a primary home.

Is a loss on selling your home tax deductible?

No. A loss on a principal residence is a nondeductible personal loss and cannot offset other gains. A loss on investment or rental property is a capital loss, subject to the netting and $3,000 annual limit rules.

Try it on the calculator

Enter the sale price, basis, and holding period in the calculator, and read the gain, the exclusion, and the tax before the closing date.

Open the Capital Gains Tax Calculator →
Related guides

Similar Posts