(Elise Amendola/AP)

Your recent article on capital gains on the sale of multiple homes got me thinking about exactly how to calculate that profit.

Is the profit the difference between the sale price of the house today against your current mortgage balance, or it is the difference between the sale price today against the original purchase price, adjusted for whatever permanent modifications you made after the purchase (adding a deck, finishing the basement, updating the kitchen, etc.)?

Second question: We are inheriting my in-laws’ home in another state. We intend to keep the house for our exclusive use (not as a summer rental) for another 18 months and then move into it as our permanent residence for the next 10 years. How do we determine the base value of this property that we would use to calculate the profit when we sell that house?

We’ll start with your first question. You could buy a home for $100,000 in cash, have no mortgage on the property and later sell it for $500,000 for a profit of $400,000. Or you could have refinanced a mortgage on that property over the years and have a $300,000 loan still due at the time you close on the sale.

In our example, if there was no mortgage on the property, you’d end up with $400,000 in cash (excluding all of the costs of sale, of course); but if you had a $300,000 mortgage on the property, you’d only end up with $100,000 in cash at closing. As you can see, the amount of money you end up with from either of these scenarios is quite different.

In computing that profit, you have to figure out what the property “cost” you. Accountants frequently talk about your cost basis in a property. To calculate the cost basis, you start with the purchase price and add the other costs of purchasing the property; then you add in the capital improvements you have made to the property over the years. When those improvements are structural or mechanical (as opposed to decorative), you can add those in as well to your “cost.”

When you sell the property, you have costs associated with the sale of the property, including commissions, transaction fees and other closing expenses. To calculate the cost basis, add the costs of purchase, capital expenses and cost of sale together. The total is your true cost basis for the property.

If in our example, you had capital expenses, purchase costs and selling expenses of $150,000, your cost basis would be $250,000. So if you sell the property for $500,000, you’d have a $250,000 profit. You asked about the costs of adding a deck, finishing the basement, and updating the kitchen. It would seem to us all of those improvements would add to the cost basis of your home.

We’ve greatly simplified our example for you and didn’t take into account whether the property was an investment property and whether you took depreciation on your federal income tax returns. Depreciation gives you tax benefits over the time you own the property but that depreciation affects your basis — that is, it reduces your basis.

We should also mention that if you are selling your primary residence (and have lived in the residence for two out of the last five years), you can exclude from federal income taxes up to $250,000 of profit; and if you are married, you can exclude from federal income taxes up to $500,000 of profit. For the vast majority of homeowners selling their primary residence, they won’t have to worry about paying federal income taxes when they sell their home.

On the second home you inherited, the “cost” to you should be the value of the home at or around the time you inherited the home. So if you inherited the home and it was worth about $250,000, that’s your starting point. You’ll use that home as a second home for some time and if the tax laws stay the same, that home will eventually become your primary residence and you should get the same $250,000/$500,000 exclusion from federal income taxes, but you would still have to recapture any depreciation you take when the property is a rental.

As you own that home, be sure to keep printed or digital records of capital improvements you make over time.

Ilyce Glink is the creator of an 18-part webinar+ebook series called “The Intentional Investor: How to Be Wildly Successful in Real Estate” as well as the author of many books on real estate. She also hosts the “Real Estate Minute” on her YouTube channel. Samuel J. Tamkin is a Chicago-based real estate attorney. Contact them at ThinkGlink.com.