How to Calculate Capital Gain on Selling a House

By: Jayne Thompson | Reviewed by: Ashley Donohoe, MBA | Updated March 31, 2019

If you sell a house for more than you bought it for, you may need to pay capital gains tax on the difference. This tax is levied on the profit from the sale of property, whether that's an investment property or your home. The good news is that most taxpayers get to keep all of the profit when selling their main home by using home sale exclusion provided by the Internal Revenue Code.

Calculating the Capital Gain

First things first – it's called a capital gains tax because the tax is levied on the gain, or profit, you make when you sell the house, rather than the amount you sell the house for. To work out the gain, you simply deduct the "cost basis" of the house from the "net proceeds" you receive from the sale.

  • If this is a negative number, you've made a loss.
  • If this is a positive number, you've made a gain.

Some or all of this gain may be taxable. If the house is your primary residence, then the Internal Revenue Service lets you exclude up to $250,000 of gain ($500,000 if married filing jointly) if you meet a few requirements – more on that below.

What Is the Cost Basis?

The cost basis is the price you paid for the house, plus:

  • Any legitimate costs you incurred in the purchase.
  • The cost of any major improvements such as replacing the roof or windows. Jobs that are purely decorative (painting the bedroom) and everyday maintenance (fixing a leaky faucet) don't count.

The costs you incurred when you bought the house are likely to be substantial, since home buyers typically pay between 2 to 5 percent of the purchase price in closing fees. Some typical fees you may have paid include a mortgage application fee, appraisal fee, attorney fee, escrow (closing) fee, credit reports, upfront mortgage insurance premium (applied on FHA loans), home inspection fees, title insurance, loan discount points, transfer taxes and more.

All of these fees are listed on the HUD-1 settlement statement you received when you purchased the house. You want to make sure you have the cost basis in place for when you do your taxes.

Net Proceeds From Sale of House

If you sell a house for $300,000, you don't receive the full $300,000. There are costs associated with the sale, and you get to deduct all of these costs from the selling price to arrive at your net sales proceeds. Examples include the broker's commission, home staging fees, inspection reports and transfer taxes.

Here's an example: John and Mary bought a house in 1996 for $200,000 and sold it in 2019 for $600,000. On the face of it, it looks like they made a profit of $400,000. However, the couple incurred $10,000 worth of fees and expenses when purchasing the home, and $40,000 in fees and commissions on the sale. In 2005, John and Mary built out their basement at a cost of $55,000.

Their cost basis here is $265,000 ($200,000 + $10,000 + $55,000), and their net sales proceeds are $560,000 ($600,000 - $40,000). By the time they finish totaling these costs, their capital gain is the much lower figure of $295,000.

Capital Gains Tax on Real Estate

The general rule is that you have to report the full amount of gain on your tax return and pay capital gains tax on it at the appropriate rate. However, most people will not have to pay any capital gains tax on the sale of a home at all. That's because the IRS allows you to exclude up to $250,000 of the gain or $500,000 if you're married and filing jointly.

Of course, there's a catch. To claim the exemption:

  1. The house must be your primary residence, not a second home or an investment property. If you rented the property to tenants, then the full gain will be taxable.
  2. You must have lived in the house for at least two out of the last five years immediately before you sold it – house flippers beware! The two years don't have to be consecutive, and you don't have to be living in the home on the date of the sale. For example, you could live in the home for a year, rent it out for three years, then live in it again for another year, and the exclusion would still apply.
  3. You must have owned the house for at least two of the last five years. If you bought the house from your landlord, for instance, and sold it a year later, then the exclusion won't apply, even if you lived in the house for 20 years as a tenant.

Selling Due to Hardship

If you lived in the home for less than two years, you might still be able to exclude a portion of the gain if you have to sell the home:

  • Due a job relocation
  • For medical or health reasons
  • For another unforeseen circumstance such as a death, divorce or natural disaster that means you're unable to meet the living expenses of your current home

IRS Publication 523 has more information about special hardship circumstances. If you find yourself in this situation, you can usually claim a portion of the exclusion based on the number of months you actually lived in the property. For example, if you lived in the home for 12 months before selling it (instead of the required 24), you could exclude half the gain from your taxable income ($125,000 or $250,00 if married filing jointly). If you made a $150,000 profit, for instance, you would include $25,000 (i.e. the amount over $125,000) as taxable income on your tax return.

It's a good idea to get a letter from your employer or physician explaining why you needed to sell the home before the two-year residency period was up in case the IRS wants confirmation

How Much Capital Gains Tax Will I Pay?

If you make a profit in excess of the exclusion amount or you don't qualify for an exclusion, then you must report the gain on Schedule D of Form 1040 as a capital gain as follows:

  • Report the gain as a short-term gain if you owned the house for less than a year. The gain is taxed at your ordinary income tax rate.
  • Report the gain as long-term gain if you owned the house for more than one year. These gains are taxed more favorably at 0, 15 or 20 percent depending on the amount of gain.

As a quick way to find out what you're in for, use an online capital gains calculator for home sale transactions to work out your gain and your tax liability.

Keeping scrupulous records is key. If you have a capital gain greater than $250,000 ($500,000 if you're married), the title company should give you a 1099-S which tells the IRS the final sale price of the property as well as any real estate taxes you have paid. You must file this form when doing your taxes.

Video of the Day

About the Author

Jayne Thompson earned an LLB in Law and Business Administration from the University of Birmingham and an LLM in International Law from the University of East London. She practiced in various “big law” firms before launching a career as a commercial writer. Her work has appeared on numerous financial blogs including Wealth Soup and Synchrony. Find her at www.whiterosecopywriting.com.

Zacks Investment Research

is an A+ Rated BBB

Accredited Business.