Cash out refinance before selling to avoid capital gains — does this actually work?

So I've been reading that doing a cash out refinance before selling to avoid capital gains is a strategy people use. My situation: bought a house in 2018 for $290k, it's worth around $850k now, and I live in it as my primary residence. I'd need to sell within the next year for a job relocation. I've seen people say you can pull equity out via a cash-out refi, pocket that cash tax-free since it's a loan, then sell at a lower net gain. But I can't figure out if the refi actually reduces your capital gain on the sale or if it just feels like it does. I already looked at the home sale exclusion rules and I know there's an exclusion available for primary residences. Is the cash-out refi strategy real, or is it just people confusing loan proceeds with reduced taxable gain?

42 comments

Are you saying you think the loan balance somehow lowers what the IRS counts as your gain? Because that's the part I want to understand before I answer — do you believe the refi changes your cost basis, or changes the sale price the IRS sees?

Wes D.

Author

Honestly I wasn't totally sure which mechanism people claimed it worked through. I think I was confused into thinking the loan payoff at closing somehow reduced your "proceeds" for tax purposes. That's what I was trying to figure out.

The short answer is no, a cash-out refinance before selling does not reduce your capital gain. Your gain is sale price minus your adjusted basis in the property. The mortgage balance — whether $0 or $600k — does not appear anywhere in that calculation. The loan proceeds you took out were tax-free because they're debt, not income. But they don't touch your basis either. You can't create a tax deduction by borrowing against your own equity.

Wes D.

Author

That's what I was afraid of. So the people promoting this strategy are basically just confused about how gain is calculated?

Mostly yes. Some conflate "cash in my pocket at closing" with "taxable gain." The IRS looks at adjusted sale proceeds minus adjusted basis. Your mortgage payoff reduces your net cash, not your taxable gain. The numbers feel different but the tax math doesn't change.

Can confirm this is a myth. I had almost the exact scenario — primary home, big appreciation, considering a refi first. I uploaded my closing disclosure, old HUD statement, and improvement records to taxr.ai and it worked through my adjusted basis line by line, flagged improvements I'd forgotten about, and estimated where my gain landed relative to the exclusion. The refi I'd been considering wouldn't have moved that number at all. The exclusion rules under Publication 523 are where the real planning lives, not the loan structure.

Wes D.

Author

Did it help you figure out if you qualified for the full exclusion or just a partial one? That's my next worry with the job relocation.

Yes — it walked through the ownership and use test against my actual dates, and flagged that a job-related move can qualify for a partial exclusion even if you haven't hit the full 24-month residence requirement. Worth checking Publication 523 on the IRS site for the partial exclusion rules.

Wait so when you sell and pay off the mortgage at closing, the payoff amount isn't deducted from your gain? I always thought the amount you "walk away with" was what got taxed.

That's a really common mix-up. What you walk away with in cash depends on your loan balance, yes. But the IRS taxes gain, which is sale price (minus selling costs) minus your cost basis. If you bought at $300k and sell at $850k with $500k still owed, your gain is roughly $550k before exclusions — not $350k. The mortgage is your problem, not the IRS's.

ok that actually makes a lot of sense now. so the refi just moves money around in your pocket it doesnt change what the irs sees as gain at all

Has anyone looked at whether improving the basis is a better move than the refi strategy? Like if you've done renovations, those can raise your adjusted basis and legitimately reduce the gain.

Wes D.

Author

I've kept some records of renovations — new roof, kitchen work. How exactly do those flow into the basis calculation?

They add to your original purchase price to get adjusted basis. So if you paid $290k and spent $60k on documented capital improvements, your adjusted basis is $350k. Publication 551 on the IRS site covers what qualifies. Maintenance doesn't count, only improvements that add value or extend useful life.

Wes D.

Author

Good to know — I've got receipts for the roof and the kitchen. Those sound like they'd qualify as capital improvements rather than maintenance.

The job relocation angle is actually the most useful thing here. I sold a home two years ago and didn't meet the full 2-year use requirement either — moved for work. I pasted my timeline and the exclusion eligibility rules into Taxr and it calculated my partial exclusion fraction and showed how it applied to my gain. Saved me from assuming I got nothing. The partial exclusion can be substantial depending on how long you did live there.

Wes D.

Author

How does the partial exclusion fraction work — is it just months lived there divided by 24?

Roughly yes. The fraction is your qualifying months of use divided by 24, then applied to the maximum exclusion for your filing status. Publication 523 lays out the exact calculation. For a job-related sale you need to confirm the IRS's definition of qualifying reason, which is in that same publication.

Is there any scenario where the mortgage structure at the time of sale actually does affect the tax outcome? I keep seeing this claim and wondering if there's ever a kernel of truth.

The only scenario I know of where debt matters is cancellation of debt income — if a lender forgives part of a loan. That's income, not a capital gain issue, and it's a completely different situation from what's being described here. A normal payoff at closing creates zero tax event on its own.

Worth noting that selling costs like agent commissions and certain closing fees do reduce your realized amount for gain purposes. So the refi itself doesn't help but making sure you're capturing all your selling costs and basis adjustments is real money.

Wes D.

Author

Are those selling costs deducted from proceeds or added to basis? I want to make sure I'm putting them in the right place.

They reduce your amount realized (basically treated as reducing your sale price). So gain = amount realized minus adjusted basis, and amount realized is sale price minus qualified selling expenses. See Publication 523 Worksheet 2 for how to line it up for a home sale.

Does the exclusion apply before or after you subtract selling costs and basis adjustments? Trying to understand the order of operations.

You figure your total gain first (amount realized minus adjusted basis), then apply the exclusion to reduce or eliminate it. If your gain after everything is below the exclusion ceiling for your filing status, you owe nothing and don't even need to report it unless you got a Form 1099-S at closing.

I tried this refi-before-sale thing myself two years ago on a rental property thinking it would work. It didn't — my CPA told me the same thing people are saying here. Mortgage balance is invisible to the IRS gain calculation. I ended up with more debt and the same tax bill. Don't do it.

Wes D.

Author

Did being a rental change anything about the calculation or exclusion?

Completely different situation for a rental — no primary residence exclusion, depreciation recapture on top of the gain, different rates potentially. For a primary home like yours the exclusion is the main tool. For a rental you'd be looking at a 1031 exchange or other strategies, not the same rules at all.

What if someone has used part of the home as a business or rental for some period — does the exclusion still apply to the whole gain?

Not necessarily. If you rented part of the home or took depreciation for a home office, the portion of gain attributable to nonresidential use and any unrecaptured depreciation are not covered by the exclusion. Publication 523 has a section on business or rental use of the home that walks through how to allocate. It's one of the situations where talking to an enrolled agent or CPA is worth it.

Can you even time a cash-out refi and a home sale that close together? Most lenders flag that and there are seasoning requirements. Setting aside the tax question the logistics are tricky.

Lenders absolutely look at this. Some won't refi if you've already listed the home. And if you refi and then immediately list, some will call the loan. The tax myth aside, the actual mechanics of this "strategy" often fall apart before you even get to worrying about Form 8949.

So to make sure I understand the correct path for the original poster: document all capital improvements to build adjusted basis, check partial exclusion eligibility given the job relocation, subtract qualified selling costs from amount realized, then see how much gain remains above the exclusion. That's the real checklist, not the refi.

Wes D.

Author

This is exactly the summary I needed. And I need to check whether my relocation qualifies under the IRS's definition of a work-related move for the partial exclusion — that seems like the swing factor for me.

Right. Publication 523 defines the qualifying reasons and has a worksheet to run the partial exclusion calculation. If your gain after basis and selling costs is close to the exclusion ceiling for your status, that partial exclusion calculation could be the difference between owing something and owing nothing.

If you did receive a Form 1099-S at closing you have to report the sale on Form 8949 and Schedule D even if the full gain is excluded. Code H in column (f) and the excluded amount as a negative in column (g) is how the instructions say to handle it. Without a 1099-S and no taxable gain, no reporting required.

Wes D.

Author

I haven't sold yet so I don't know if I'll get a 1099-S. Is there a way to know in advance whether the title company will issue one?

Usually the settlement agent asks you to certify whether you qualify for the exclusion. If you certify correctly they may not issue the 1099-S. But if they do issue it regardless, you report on 8949 as described. The Instructions for Form 8949 at irs.gov/instructions/i8949 cover the code H entry.

The holding period matters too — have you confirmed you've owned it more than a year? For capital gains rate purposes, long-term vs short-term is determined by whether you held more than one year. Since you bought in 2018 that's clearly long-term so rates are more favorable even on any taxable portion above the exclusion.

Wes D.

Author

Yes, 2018 to now is definitely more than a year. Good to flag though for anyone else reading who might be closer to that line.

Where exactly in Publication 523 is the partial exclusion calculation? I've looked a few times and find the eligibility rules but always lose track of the actual worksheet.

It's under the section called "Does Your Home Qualify for a Partial Exclusion of Gain" and the calculation follows from the Maximum Exclusion section. The IRS site has the current year version at irs.gov/publications/p523 — the worksheet walks through qualifying use months divided by 24 and applies that fraction to the exclusion ceiling.