Please ensure Javascript is enabled for purposes of website accessibility

This device is too small

If you're on a Galaxy Fold, consider unfolding your phone or viewing it in full screen to best optimize your experience.

Skip to main content

A Complete Guide to Capital Gains Tax on Real Estate Sales

Dana George
By: Dana George

Our Taxes Expert

Margo Winton Parodi
Check IconFact Checked Margo Winton Parodi
Many or all of the products here are from our partners that compensate us. It’s how we make money. But our editorial integrity ensures our experts’ opinions aren’t influenced by compensation. Terms may apply to offers listed on this page.

When you sell an asset for more than it cost you to acquire it, the difference is known as a capital gain. For example, if you paid $1,000 to buy stock and sell the same stock for $1,200 (net of expenses), you have a capital gain of $200.

In most, but not all situations, the profits you make upon the profitable sale of an asset are taxable. Since it is a tax being applied to a capital gain, it is appropriately known as a capital gains tax. In this article, we'll discuss the two main types of capital gains, how each one is taxed, and some real-estate-specific rules you need to know.

If you're a higher-income taxpayer, you may have to pay an additonal 3.8% net investment income tax.

However, if you held the asset for a year or less before you sold it, any net profit will be considered a short-term capital gain, which is taxable as ordinary income. For example, if you're in the 22% tax bracket, that's the rate you'll pay on short-term gains.

Capital gains tax on a primary residence

If you sell your primary home, it could be entitled to special treatment, even if the sale gave you a six-figure profit. However, it's not as simple as selling a home you live in. To get the primary residence exclusion, you need to meet two conditions:

  • You need to have owned the home for at least two out of the previous five years.
  • You need to have lived in the home as your primary residence for at least two of the previous five years.

You don't have to live in the home for two consecutive years, but a minimum of two years out of the last five. And you can only use the exclusion once every two years. In other words, if you buy a home and sell it a year later, you can't use the exclusion, regardless of whether it was your primary home during your ownership.

If you qualify, the primary residence exclusion can exempt as much as $500,000 of net profit from capital gains tax for married couples filing jointly, or $250,000 for all other taxpayers. So if your cost basis on your home that you own jointly with your spouse is $400,000 and you eventually sell it for $900,000, the IRS can't touch a penny of your gains. It's only when you exceed $500,000 in net profit that the proceeds will be taxed.

Furthermore, because there's a minimum two-year ownership period used to define a primary residence, any capital gains you owe on such a sale are long-term capital gains.

Cost basis 101

Before we go any further, it's important to mention the concept of cost basis since it's used to determine your potential tax liability.

In a nutshell, your cost basis in a property can include three components:

  • The purchase price of the property.
  • Certain acquisition-related expenses, such as legal fees and transfer taxes.
  • Property improvements that add value to the property or extend its useful life (but not maintenance or necessary repairs).

As a basic example, if you acquire a property for a $200,000 purchase price, pay $5,000 in acquisition expenses, and spend $20,000 to renovate the kitchen, your cost basis will be $225,000.

Let's say you receive a job transfer and must sell your home 10 months after buying it. If you manage to sell it for more than you bought it for, you can reduce that profit by the amount it cost to acquire the home, plus any improvements you made that added value during the 10 months you were there. Depending on those two expenses, you may even avoid paying short-term gains.

Capital gains tax on a second home

A second home is generally defined as a property that you live in for part of the year, and that isn't primarily a rental property. For example, if you have a condo at the beach that you live in for two months every summer and also rent out for a month during the summer season, it is likely considered to be a second home.

You may own more than one property that meets the definition of a "second home." For example, if you have a beach condo and mountain cabin that you live in at certain times during the year, but you also maintain a primary residence, both properties can be considered second homes for tax purposes.

Since a second home doesn't meet the IRS definition of a primary residence, it is not entitled to the capital gains exclusion. In a nutshell, any net capital gain you make upon the sale of a second home is taxable at the appropriate rate (long term or short term).

Capital gains tax on an investment property

After the sale of an investment property, there are two types of tax that you may face.

First, if you sell the property for a net profit relative to your cost basis, you'll have to pay capital gains tax.

In addition, if you've claimed depreciation expenses on the property during your holding period (this is always the case with rental properties), the cumulative amount you've deducted will be considered taxable income when you sell. This concept is known as depreciation recapture. In essence, it's the government recapturing the savings you enjoyed due to the depreciation deduction.

Consider this example. Let's say that your cost basis in a duplex is $250,000 and that you've owned it for 10 years. Over the 10-year ownership period, you've claimed a total of $90,900 in depreciation expense. If you sell the property now for net proceeds of $350,000, you'll owe long-term capital gains tax on your $100,000 net profit plus depreciation recapture on $90,900, which is taxed at your marginal tax rate.

Avoiding capital gains tax on investment properties

As you can see, selling an investment property -- especially one you've held for a long time -- can result in quite a hefty tax bill.

Fortunately, there's a way to avoid paying both capital gains and depreciation recapture taxes, at least for a while. This is known as a 1031 exchange, and while there are several important rules and procedures that must be followed, the basic idea is that as long as you use all of the proceeds from the sale of your investment property to acquire another investment property, you can defer taxes until the eventual sale of the replacement property.

When in doubt, ask for help

As a final point, it's important to emphasize that there is no way we can cover every potential real estate sale situation in this article, and there's admittedly some gray area in the tax code. For example, maybe you made a certain repair/improvement during your ownership and you aren't sure whether it should be added to the property's cost basis.

In situations like this, it's important to seek the advice of a qualified professional, such as a tax attorney or a reputable and experienced tax professional. Ideally, look for one who specializes in real estate issues. High-dollar tax issues, like real estate capital gains, are closely watched by the IRS, so it's not only important to seek advice to make sure you maximize your tax breaks, but to make sure you're doing it correctly.

Our Taxes Experts