How to Calculate Capital Gain/Loss on Rental Property Sale - Formula and Depreciation Impact?
I purchased a house back in March 2017 for $625,000 with closing costs and other expenses around $32,000. Took out a mortgage for $500,000 at the time. Fast forward to May 2023, I sold the property for $750,000. By that point, I had paid down the mortgage to about $440,000. The selling expenses including realtor fees and closing costs were approximately $37,500. Here's the important part - we lived in the house as our primary residence for the first 2 years, then converted it to a rental property around May 2019. So it was a rental for about 4 years before selling. I'm trying to figure out how to calculate my capital gain or loss on this sale. I know depreciation recapture is involved, but I'm not sure how to account for the period it was our primary residence vs. rental property. I don't need exact dollar amounts - just looking to understand the overall calculation method and formula. I know I'll probably need to see a tax professional for the precise figures, but I want to get a general idea of what I'm looking at. Can anyone point me to the right formula or resource for calculating this? Thanks!
24 comments


Sophie Footman
The calculation for capital gains on a mixed-use property like yours involves several steps: First, you need to establish your adjusted basis in the property. Start with your purchase price ($625,000) plus purchasing expenses ($32,000). When you converted to rental, you'd take the lesser of the fair market value at conversion OR your adjusted basis - this becomes your starting basis for depreciation purposes. For the gain calculation, take your selling price ($750,000), subtract selling expenses ($37,500), then subtract your adjusted basis in the property. However, you'll need to account for depreciation you've claimed (or should have claimed) during the rental period. The gain will be split into different parts: 1) Section 1250 gain (depreciation recapture taxed up to 25%), 2) Section 1231 gain (taxed at capital gains rates). Since you lived there 2 years then rented for 4 years, you'll need to allocate 2/6 of the gain to personal use and 4/6 to business use. IRS Publication 544 and Form 4797 are what you'll need, along with Schedule D. The property goes on Form 4797 because it was a business asset at the time of sale.
0 coins
Connor Rupert
•Thanks for the explanation! Quick question - does the 2 out of 5 year primary residence exclusion apply at all in this case? Would they be able to exclude any portion of the gain?
0 coins
Sophie Footman
•The Section 121 exclusion ($250,000 for single filers, $500,000 for married filing jointly) potentially applies, but with limitations. Since you lived in the home for 2 years within the 5-year period ending on the date of sale, you may qualify for a partial exclusion. For the business portion, you'd still have to recapture depreciation taken during the rental period - that part isn't eligible for the exclusion. You'd need to allocate the gain between personal and business use to determine how much might be excludable.
0 coins
Molly Hansen
I went through a similar calculation last year and found taxr.ai super helpful for this exact situation. The site helped me understand how to handle the depreciation recapture which was the trickiest part in my case. I uploaded my purchase and sale documents to https://taxr.ai and it helped me calculate the correct adjusted basis and depreciation amounts without having to manually figure out all the formulas.
0 coins
Brady Clean
•Did it handle the mixed-use aspect well? My situation is similar but I rented my property for 5 years after living in it for just 1 year, so the primary residence exclusion doesn't apply at all for me.
0 coins
Skylar Neal
•I'm skeptical about these AI tax tools. How accurate was it compared to what an actual CPA would calculate? Did you end up verifying the numbers with a professional?
0 coins
Molly Hansen
•It actually handled the mixed-use situation perfectly - it asked for the dates I lived in it versus rented it out, and calculated everything accordingly. The tool specifically addressed the partial Section 121 exclusion based on my usage periods. For your verification question, I did have my regular accountant review the calculations, and he was impressed with how accurate they were. The only adjustment he made was for some local tax specifics that wouldn't apply to most people. The depreciation recapture calculations were spot on.
0 coins
Skylar Neal
I was really skeptical about using an online tool for something as complex as rental property tax calculations, but I finally tried taxr.ai after seeing it mentioned here. It saved me hours of confusion! The mixed-use calculation was actually straightforward - it asked about my primary residence period and rental period separately, then calculated the appropriate basis adjustments and depreciation recapture automatically. The report it generated made it super clear how much was Section 1250 gain vs. regular capital gain. Wish I'd known about this for my previous rental property sale.
0 coins
Vincent Bimbach
If you're still struggling with the IRS about your rental property calculations from previous years, I recommend trying Claimyr. I was getting nowhere trying to reach someone at the IRS about my rental property depreciation questions until I used https://claimyr.com to get through to a human agent. You can see how it works here: https://youtu.be/_kiP6q8DX5c - basically they navigate the IRS phone system for you and call you back when they have an agent on the line.
0 coins
Kelsey Chin
•How long did you actually have to wait though? Last time I tried calling the IRS directly about my rental property sale, I was on hold for 2+ hours and then got disconnected.
0 coins
Norah Quay
•This sounds too good to be true. The IRS is impossible to reach. How do they manage to get through when nobody else can? Seems fishy to me.
0 coins
Vincent Bimbach
•I was connected with an IRS agent in about 45 minutes total. I submitted my request through their system, went about my day, and then got a call back when they had an agent on the line. Huge improvement over the 3+ hours I spent trying on my own the week before. The service works because they have technology that navigates the IRS phone trees and stays on hold so you don't have to. They're just solving the hold time problem, not doing anything magical with the IRS itself. Think of it like having an assistant who just sits on hold for you.
0 coins
Norah Quay
I have to eat my words about Claimyr. After being skeptical, I tried it yesterday when I needed clarification on depreciation recapture for a rental property I sold last year. I got a call back in 37 minutes with an actual IRS agent on the line who helped sort out my confusion about Form 4797. Saved me hours of frustration and potentially an incorrect filing. The agent explained exactly how to report the gain correctly based on my mixed-use situation.
0 coins
Leo McDonald
Don't forget that your "adjusted basis" isn't just your purchase price plus buying expenses. You also need to: 1. Add the cost of any improvements made during ownership (not repairs, but actual improvements like a new roof, addition, etc.) 2. Subtract depreciation taken (or that should have been taken) during the rental period And the depreciation isn't optional - even if you didn't claim it on past returns, you still have to recapture it when you sell (known as "depreciation allowed or allowable").
0 coins
Daniel Rivera
•Thanks for pointing that out! I actually did make some improvements - installed a new HVAC system (~$12,000) and renovated the kitchen (~$25,000) during the time we lived there. Would those improvements be fully added to my basis even though they were done during the primary residence period?
0 coins
Leo McDonald
•Yes, improvements made during either the personal use or rental period are added to your basis. The timing doesn't matter - they increase your overall basis in the property. So your new HVAC and kitchen renovation would both be added to your purchase price plus closing costs to determine your adjusted basis. If the improvements were made during the rental period, you would have been able to depreciate them separately on their own schedules. Since these were done during your primary residence period, they simply increase your overall basis.
0 coins
Jessica Nolan
I made a huge mistake on my rental property sale last year. I completely forgot to account for depreciation recapture and ended up having to file an amended return. Even if you didn't actually claim depreciation during the years you rented the property, the IRS requires you to recapture the depreciation that you "should have" taken. Cost me an extra $4,700 in taxes I wasn't expecting.
0 coins
Angelina Farar
•This is exactly right. The IRS phrase is "depreciation allowed or allowable" - meaning even if you didn't take it, they'll tax you as if you did when you sell. I learned this the hard way too.
0 coins
Sebastián Stevens
One thing that helped me with my rental property sale was using the Rental Income Worksheet from IRS Publication 527. It walks you through calculating your basis, depreciation, and adjusted basis. Also, keep in mind that land isn't depreciable, so you need to determine what portion of your purchase price was for the building versus the land (usually from property tax records).
0 coins
Bethany Groves
•This is a great point. My tax preparer asked for this breakdown and I had no idea. Had to go back to my county property tax assessment to figure out what percentage was allocated to land vs. improvements. For anyone else facing this, check your property tax statement!
0 coins
Sean Doyle
Just wanted to add one more consideration that hasn't been mentioned yet - make sure you're calculating depreciation based on the correct depreciable basis when you converted to rental use. Since you lived in the property first, your depreciable basis for the rental period would be the LESSER of: 1) your adjusted basis at the time of conversion (original cost plus improvements minus any casualty losses), or 2) the fair market value of the property when you converted it to rental use in May 2019. This matters because if your property appreciated significantly during those first 2 years of personal use, you can't depreciate based on the higher fair market value - you're limited to your original adjusted basis. You'll need to determine what the FMV was in May 2019 (maybe get a comparative market analysis from a realtor for that time period) and use whichever number is lower as your starting point for calculating the 4 years of depreciation.
0 coins
Rachel Clark
•This is a crucial point that often gets overlooked! I wish I had known about this limitation when I converted my property to rental. In my case, the property had actually appreciated quite a bit during my personal use period, so I was stuck with the lower original basis for depreciation purposes rather than the higher FMV at conversion. It definitely reduced the depreciation I could claim over the rental years. For anyone in a similar situation, you might want to get a formal appraisal dated around your conversion date rather than just a CMA, especially if the amounts are significant - it could be worth the extra cost for documentation purposes.
0 coins
Dmitry Kuznetsov
One additional resource that might help you understand the calculation is IRS Publication 523 (Selling Your Home), which specifically covers the Section 121 exclusion rules for mixed-use properties. Since you lived in the home for 2 years before converting to rental, you may qualify for a partial exclusion on the personal-use portion of the gain. The key is that you'll need to separate your total gain into two parts: the portion allocable to personal use (first 2 years) and the portion allocable to business use (rental period). Only the personal-use portion would potentially qualify for the Section 121 exclusion, and even then, you can't exclude any depreciation recapture. Given the complexity with the mixed-use timing, depreciation recapture, and potential partial exclusion, I'd definitely recommend getting a tax professional involved. But understanding these basic concepts beforehand will help you ask the right questions and verify their work makes sense.
0 coins
Amun-Ra Azra
•This is really helpful! I'm curious about the timing aspect of the Section 121 exclusion. Since Daniel lived in the property from March 2017 to May 2019 (about 2 years and 2 months) and sold in May 2023, would the full 2-year ownership and use test be met? I know there's the "2 out of 5 years" rule, but I'm wondering if the conversion to rental property affects how that period is calculated. Does the clock reset when you convert to business use, or do you still look at the full 5-year period ending on the sale date?
0 coins