Capital Gains Tax Calculator
Calculate your capital gains tax on the sale of residential property, investment real estate, and rental property. Free online estimator with Section 121 exclusion and 1031 exchange support.
Real estate capital gains tax is a tax on the profit you earn when you sell a property for more than its cost basis. Whether you are selling your primary home, an investment property, or a rental unit, understanding how this tax applies to real estate transactions is critical for financial planning. The Internal Revenue Code treats real estate as a capital asset, meaning the same fundamental capital gains tax principles apply, but real estate has several unique provisions and exclusions that can significantly affect your tax liability.
The basic calculation for real estate capital gains is straightforward: subtract your adjusted cost basis from your net sale proceeds. However, the adjusted cost basis for real estate is more complex than for stocks or bonds. Your cost basis includes not only the original purchase price but also closing costs from the purchase, capital improvements made during ownership, and certain other expenses. Similarly, your net proceeds account for selling expenses such as real estate agent commissions, transfer taxes, and legal fees. The difference between these two figures determines your capital gain or loss.
The holding period of the property determines whether your gain is classified as short-term or long-term. Properties held for one year or less generate short-term capital gains, taxed at ordinary income rates up to 37%. Properties held for more than one year produce long-term capital gains, taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income. Given that most real estate investments are held for multiple years, most property sales result in long-term capital gains, which benefit from substantially lower tax rates.
Several special provisions in the tax code directly affect real estate capital gains. The Section 121 exclusion can shield a significant portion of gain from taxation on a primary residence. The Section 1031 exchange allows deferral of gains when reinvesting in similar property. Depreciation recapture taxes previously claimed depreciation at a separate rate of up to 25%. Understanding how these provisions interact is essential for anyone buying, selling, or managing real estate investments.
The Section 121 exclusion is one of the most powerful tax benefits available to American homeowners. Under this provision, you can exclude up to $250,000 of capital gains from the sale of your primary residence if you are single, or up to $500,000 if you are married filing jointly. For many homeowners, this exclusion completely eliminates any federal capital gains tax liability on the sale of their home. However, specific eligibility requirements must be met to qualify for this valuable tax break.
If you do not meet the full two-out-of-five-year test due to a job relocation, health problems, or certain unforeseen circumstances, you may qualify for a partial exclusion. The reduced exclusion is calculated as a fraction based on the portion of the two-year requirement you did satisfy. For example, if you lived in the home for only one of the required two years, you could potentially exclude 50% of the maximum amount ($125,000 for single filers or $250,000 for married couples).
It is important to note that the Tax Cuts and Jobs Act of 2017 changed the rules for converting a rental property into a primary residence. Previously, you could rent a property and then move in for two years to qualify for the exclusion on the entire gain. Now, the exclusion only applies to gains accrued during the period the property was used as your primary residence. Depreciation taken during the rental period is still subject to recapture rules regardless of the Section 121 exclusion.
A 1031 exchange, also known as a like-kind exchange, is one of the most powerful tax deferral strategies available to real estate investors. Under Section 1031 of the Internal Revenue Code, you can defer paying capital gains tax when you sell an investment property and reinvest the proceeds into a similar (like-kind) property. This strategy effectively allows you to preserve your entire investment capital and continue building wealth through real estate without losing a significant portion to taxes.
To execute a valid 1031 exchange, several strict requirements must be followed. First, the property being sold and the replacement property must both be held for investment or business purposes; personal residences do not qualify. Second, you must use a qualified intermediary (QI) to handle the transaction. The QI holds the sale proceeds in a segregated account and facilitates the purchase of the replacement property. Third, you must identify the replacement property within 45 calendar days of the sale and complete the purchase within 180 calendar days.
The property identification rules allow you to identify up to three potential replacement properties regardless of value, or any number of properties as long as their combined fair market value does not exceed 200% of the relinquished property's value. If you purchase replacement property with a fair market value less than the relinquished property, the difference is treated as taxable boot and will trigger capital gains tax on that portion.
One important consideration is that the deferred gain does not disappear; it is carried forward into the basis of the replacement property. This is often referred to as a deferred gain. If you eventually sell the replacement property without completing another 1031 exchange, all previously deferred gains plus any additional appreciation will be subject to taxation at that time. Many real estate investors use serial 1031 exchanges throughout their investing careers, deferring taxes indefinitely until they ultimately pass the property to heirs, who may receive a step-up in basis to the fair market value at the time of inheritance.
Depreciation is a valuable tax deduction available to owners of income-producing real estate. The IRS allows you to deduct a portion of the property's cost each year as a depreciation expense, which reduces your taxable rental income. For residential rental property, the depreciation period is 27.5 years using straight-line depreciation. For commercial property, the period is 39 years. While this deduction provides meaningful annual tax savings, it creates a tax liability when you sell the property through a mechanism known as depreciation recapture.
When you sell a property that you have claimed depreciation on, the total amount of depreciation you deducted over the ownership period must be recaptured and taxed separately from your capital gain. Depreciation recapture is taxed at a maximum rate of 25%, which is higher than the 15% long-term capital gains rate but lower than the top ordinary income tax rate of 37%. This recapture applies regardless of whether you actually claimed the depreciation or not; the IRS requires recapture based on allowable depreciation even if you missed claiming it on prior returns.
Purchase price: $400,000 (land value $80,000, building value $320,000)
Annual depreciation: $320,000 / 27.5 years = $11,636 per year
Total depreciation claimed over 10 years: $116,364
Sale price after 10 years: $600,000
Adjusted basis: $400,000 - $116,364 = $283,636
Total capital gain: $600,000 - $283,636 = $316,364
Depreciation recapture (up to 25%): $116,364 x 25% = $29,091
Remaining capital gain (at 15%): $200,000 x 15% = $30,000
Total estimated federal tax: $59,091
Even if you sell your rental property and the gain would otherwise be fully covered by the Section 121 exclusion, the depreciation recapture portion is generally still taxable. The only exception is for depreciation claimed after May 6, 1997, which may be excluded up to the Section 121 limits. Always consult a tax professional to understand the full implications of depreciation recapture on your specific property and situation.
The table below illustrates estimated federal capital gains tax for different property values assuming a $100,000 cost basis, long-term holding period, and a 15% federal rate. Actual amounts vary based on your specific cost basis, improvements, depreciation, and income level.
| Sale Price | Cost Basis | Capital Gain | 15% Tax | 20% Tax | After Section 121 (Single) |
|---|---|---|---|---|---|
| $250,000 | $150,000 | $100,000 | $15,000 | $20,000 | $0 |
| $400,000 | $200,000 | $200,000 | $30,000 | $40,000 | $0 |
| $500,000 | $250,000 | $250,000 | $37,500 | $50,000 | $0 |
| $750,000 | $300,000 | $450,000 | $67,500 | $90,000 | $30,000 |
| $1,000,000 | $400,000 | $600,000 | $90,000 | $120,000 | $52,500 |
| $1,500,000 | $500,000 | $1,000,000 | $150,000 | $200,000 | $112,500 |
| $2,000,000 | $600,000 | $1,400,000 | $210,000 | $280,000 | $172,500 |
| $3,000,000 | $800,000 | $2,200,000 | $330,000 | $440,000 | $292,500 |
* After Section 121 column assumes single filer with $250,000 exclusion applied. Married couples can exclude $500,000. Actual tax varies based on income level, depreciation recapture, state taxes, and other factors.
Start with the original purchase price of the property. Add closing costs from the purchase such as title insurance, legal fees, recording fees, survey costs, and transfer taxes. Include any mortgage points not previously deducted. This total represents your starting cost basis before improvements.
Add the cost of all capital improvements made during your ownership. Capital improvements are permanent changes that increase the property's value, such as adding a room, finishing a basement, installing a new roof, replacing HVAC systems, or landscaping. Routine repairs and maintenance cannot be added to your basis. Keep receipts and records of all improvement projects.
If the property was used as a rental or for business purposes, subtract any depreciation you claimed (or were entitled to claim) on your tax returns. This reduces your adjusted basis and increases your potential gain. Even if you did not claim depreciation, the IRS requires you to reduce your basis by the allowable amount.
Subtract all selling expenses from the gross sale price. This includes real estate agent commissions (typically 5-6% of the sale price), transfer taxes, attorney fees, escrow fees, staging costs, and any other costs directly related to the sale. The remaining amount is your net sale proceeds.
Subtract your adjusted cost basis from your net sale proceeds. The result is your total capital gain. Next, separate the depreciation recapture portion (taxed at up to 25%) from the remaining gain (taxed at 0%, 15%, or 20%). If the property is your primary residence, apply the Section 121 exclusion to see how much of the remaining gain can be excluded from taxation.
Apply the depreciation recapture rate (up to 25%) to the recapture amount and the long-term capital gains rate (0%, 15%, or 20%) to the remaining gain based on your taxable income and filing status. Add the 3.8% NIIT if your income exceeds the applicable threshold. For the most accurate calculation, use our free capital gains tax calculator.
Keep detailed records of all capital improvements made to the property. Every dollar spent on qualified improvements increases your basis and reduces your taxable gain. This includes additions, remodels, new systems, and permanent landscaping. Save receipts, contracts, and before-and-after photos to substantiate improvement costs if audited.
If you are selling an investment property and plan to reinvest, a 1031 exchange allows you to defer all capital gains tax by purchasing a like-kind replacement property. This preserves your full investment capital and enables continued portfolio growth. Work with a qualified intermediary and adhere to the 45-day identification and 180-day closing timelines.
Converting an investment or rental property into your primary residence for at least two years before selling can qualify you for the Section 121 exclusion on gains accrued during your ownership period. Note that under current tax law, the exclusion only applies to gains during the period you actually lived in the home, not the rental period.
If you have capital losses from other investments such as stocks, bonds, or mutual funds, you can use these losses to offset your real estate capital gains dollar-for-dollar. If your losses exceed your gains, you can deduct up to $3,000 against ordinary income and carry forward any remaining losses indefinitely.
Donating real estate that has significantly appreciated to a qualified charity allows you to avoid capital gains tax entirely while claiming a charitable deduction for the full fair market value of the property. This strategy is particularly effective for properties with substantial unrealized gains and can provide a significant tax benefit.
Capital gains tax on real estate is calculated by subtracting your adjusted cost basis from the net sale proceeds. Your cost basis includes the original purchase price plus closing costs, capital improvements, and certain selling expenses. The net proceeds are the sale price minus agent commissions and other selling costs. For example, if you bought a property for $300,000, made $50,000 in improvements, and sold it for $500,000 with $30,000 in selling costs, your capital gain would be $500,000 minus $30,000 minus $350,000, equaling $120,000. The tax rate depends on your holding period and income level.
The Section 121 exclusion, also known as the primary residence exclusion, allows you to exclude up to $250,000 of capital gains ($500,000 for married couples filing jointly) from the sale of your primary home. To qualify, you must have owned and used the home as your primary residence for at least two of the five years preceding the sale. You can only use this exclusion once every two years. If you sell your home for a gain less than the exclusion amount, you owe no federal capital gains tax on the sale.
A 1031 exchange, named after IRS Section 1031, allows you to defer paying capital gains tax on an investment property sale by reinvesting the proceeds into a "like-kind" replacement property. The replacement property must be identified within 45 days and the purchase completed within 180 days. A qualified intermediary must hold the proceeds between transactions. This strategy effectively allows you to roll your entire investment forward without paying taxes, enabling greater portfolio growth over time. Note that 1031 exchanges apply only to investment or business properties, not personal residences.
Depreciation recapture is a tax provision that requires you to pay tax on the depreciation deductions you claimed on a rental property when you sell it. The depreciation recapture amount is taxed at a maximum rate of 25%, regardless of your regular capital gains rate. For example, if you claimed $60,000 in depreciation deductions over the years you owned a rental property, that $60,000 would be subject to depreciation recapture at up to 25% ($15,000) when you sell. Any remaining gain above the recapture amount is taxed at the standard capital gains rate.
Yes, there are several strategies to minimize or avoid capital gains tax when selling a home. The most common is the Section 121 exclusion, which can eliminate tax on up to $250,000 ($500,000 for married couples) of gain if the home was your primary residence. For investment properties, a 1031 exchange allows you to defer the tax by reinvesting in another property. You can also offset gains with capital losses from other investments. Converting a rental property to a primary residence and then selling may also reduce your tax liability, though rules have tightened under the Tax Cuts and Jobs Act.
The two-out-of-five-year rule requires that you owned and used the home as your primary residence for at least two years (730 days) within the five-year period ending on the date of the sale. The two years do not need to be consecutive. You could, for example, live in the home for one year, rent it out for two years, and then move back in for one year before selling. The two years of ownership and the two years of use can overlap but do not have to be the same months. If you fail to fully meet this test due to health, employment, or unforeseen circumstances, you may qualify for a reduced exclusion.
When purchasing property, you can include many closing costs in your cost basis. These include the purchase price, title insurance, legal fees, recording fees, survey costs, transfer taxes, and any mortgage points not already deducted. When selling, you can also subtract selling expenses from your proceeds, such as real estate agent commissions, advertising costs, legal fees, and escrow fees. Capital improvements (not repairs) such as adding a room, renovating a kitchen, or installing a new roof also increase your basis. Keeping detailed records of all these expenses is essential for accurate tax reporting.
Yes, flipping houses can have significantly different tax consequences than long-term real estate investing. Properties held for one year or less are subject to short-term capital gains tax rates, which match your ordinary income tax rate (up to 37%). Additionally, if the IRS determines that your house-flipping activity constitutes a business rather than an investment, the profits may be taxed as ordinary income and subject to self-employment tax as well. Frequent flippers may also be classified as "dealers" by the IRS, which disqualifies them from using the 1031 exchange and other real estate investor tax benefits.
Most states impose their own capital gains tax in addition to the federal tax. State treatment varies widely. States like California tax capital gains as ordinary income, with rates up to 13.3%. States like Florida, Texas, Nevada, and Washington have no state income tax, meaning you only pay federal capital gains tax. Some states offer partial exclusions or preferential rates for certain types of property. When calculating your total tax liability on a real estate sale, always factor in both federal and state taxes, as state taxes can add substantially to your total bill depending on where you live and where the property is located.