Should I sell stocks and pay capital gains to buy a house with cash?

Trying to figure out if this actually makes sense financially and tax-wise. I have a decent brokerage account, mostly index funds I've held for 3+ years, and I'm looking at buying a house outright instead of getting a mortgage. The numbers are close — I'd need to sell almost everything. I pulled up my 1099-B from last year just to get a sense of my cost basis and the gains are pretty significant. I know I'd owe long-term capital gains tax but I honestly don't know how to estimate what that rate would actually be on my specific income, or if there's any way to spread this out or offset it. Is it even worth trying to avoid a mortgage just to sidestep a tax bill? Or am I thinking about this backwards? Should I sell stocks and pay capital gains to buy a house with cash, or is there a smarter way to structure this?

39 comments

Schedule D and your overall taxable income for the year are what drive this. Long-term capital gains rates depend on where your total income lands — the Form 1040 instructions and Topic 409 on irs.gov lay out the brackets. If you're selling a large block in one year you could push yourself into a higher rate tier than you'd be in otherwise. Some people spread the sales over two tax years to manage that.

Matt G.

Author

Splitting the sales across two years is something I hadn't considered. Does that actually work cleanly if the home purchase closes in year one but I'm still selling into year two?

The trade date of the sale is what matters for Schedule D, not when it settles or when you sign a purchase agreement. So yes, you could sell a portion this calendar year and the rest in January. The 1099-B you get will show the trade dates.

One thing people miss: if any of your positions are sitting at a loss, selling those in the same year offsets some of the gains on Form 8949. Capital losses reduce capital gains dollar for dollar on Schedule D before you get to the net figure. Worth reviewing every lot on your 1099-B before you decide which shares to sell first.

Matt G.

Author

I do have a couple of positions that are underwater. So I should sell those in the same tax year as the winners to net them on Schedule D?

Exactly. Short-term losses offset short-term gains first, then net long-term, and vice versa. The Schedule D instructions walk through the ordering. Even a moderate loss lot can meaningfully reduce what you owe.

Don't overlook your holding period on each lot. Publication 550 at irs.gov is clear that for securities traded on an exchange, the holding period starts the day after the trade date you bought and ends on the trade date you sell. If any lot is just barely over a year, double-check the trade date before you trigger the sale — accidentally selling a not-quite-long-term lot means short-term rates on that gain.

I ran into a similar decision last year. Before I did anything I uploaded my brokerage statement and a draft of what I was planning to sell to taxr.ai and Taxr mapped out each lot's holding period, flagged two positions that were still short-term even though I thought they were long-term, and estimated which lots to sell first to keep me in the lower rate bracket. Saved me from a pretty avoidable mistake. Still had to have my CPA confirm the final number but the groundwork was done.

Matt G.

Author

That's the kind of prep work I need to do before I call anyone. Good to know it can organize the lot-by-lot picture.

Mortgage vs. cash is also worth modeling on the after-tax cost of the mortgage interest. Some buyers find the tax drag of realizing a large gain outweighs the cost of carrying a mortgage, especially if their gains would be taxed at the higher long-term rate. Others find the reverse. Neither answer is universal — it depends on your income, the loan rate you'd qualify for, and what the portfolio would earn going forward.

Form 8949 is where every individual sale gets reported, and Schedule D is where it nets out. If you're selling dozens of lots, Exception 1 in the Form 8949 instructions lets you skip entering each one on the form and put the total straight on Schedule D line 1a or 8a — but only for covered securities with basis already reported to the IRS and no adjustments needed. Anything with a wash sale code or a corrected basis still has to go on 8949 line by line.

Wait, so if my brokerage already reports basis on the 1099-B I might not need to fill out 8949 for every single sale?

Right, that's Exception 1. Box A or D transactions — covered securities with basis reported to the IRS — with no adjustments can go directly on Schedule D. But you still need the 1099-B to match the totals. Any code W (wash sale) lot breaks that and goes on 8949.

Are you planning to use all the sale proceeds for the house or would some stay invested? That changes how much you're actually liquidating and what your gain exposure looks like.

Matt G.

Author

Probably need to sell about 90% of the account to cover the purchase price plus closing costs. So almost total liquidation.

Then your effective tax rate on the gains becomes a real cost of the house, the same way a mortgage's interest rate is a cost. Worth building that into the comparison rather than treating the tax as separate from the purchase decision.

One scenario people don't always price in: if your capital gains push your income high enough, it can also affect your net investment income tax exposure. The Form 8960 instructions cover whether that applies based on your modified adjusted gross income. Worth knowing before you finalize the sale plan.

Matt G.

Author

Haven't looked at Form 8960 at all. So there's potentially a surtax on top of the regular capital gains rate if my income crosses a certain threshold?

Correct. The threshold and rate are in the Form 8960 instructions — I won't quote the numbers here because they depend on your filing status and the current year's rules. A CPA or enrolled agent can run the actual number once you know the total gain.

Specific lots matter a lot here. If your brokerage uses average cost by default (common for mutual funds), you may want to switch to specific identification before you sell. With specific ID you can tell them exactly which shares to sell — highest cost basis lots first to minimize the gain. Check your account settings before you place any sale orders; you usually can't change the method after the sale settles.

Matt G.

Author

My account is set to average cost right now. Can I switch it before I sell and have it apply immediately?

Generally yes, but each brokerage handles this differently and some require the change to be made before the trade. Call your broker or check their cost basis settings page before you do anything. Publication 550 covers the specific identification method if you want the IRS's framing of it.

Schedule D line 16 is what determines whether you end up with a net gain or a net loss for the year after all the 8949 entries flow through. I had Taxr go through my Schedule D and 8949 drafts side by side last spring when I was selling a large position — it spotted a lot I had entered in the wrong part (short-term vs. long-term) which would have understated my long-term gain and overstated short-term. Caught it before I filed.

Does putting a lot in the wrong part actually change the tax owed or just how it's categorized?

It can change the tax owed if the rates differ — short-term gains are taxed at ordinary income rates, long-term at preferential rates. Misclassifying a long-term lot as short-term would overstate your tax; the reverse would understate it. The IRS matches 1099-B data so errors get flagged.

Worth mentioning: if you have any positions with a wash sale disallowance already coded on your 1099-B — box 1g — those losses aren't deductible in the current year. The disallowed amount gets added to the cost basis of the replacement shares instead. If you're liquidating everything, make sure you're not leaving a wash sale chain open by selling the loss lot and then buying back into the same fund within 30 days before or after.

Matt G.

Author

So if I sell everything and don't rebuy within that 30-day window on either side, I'm clear of wash sale issues on the losses?

That's right. Publication 550 defines the window as 30 days before and 30 days after the sale. The rule also covers your spouse buying substantially identical securities or you buying them inside an IRA or Roth IRA — those count as wash sales too even if the loss otherwise wouldn't be reported on your 1099-B.

Has anyone here actually done a full liquidation like this? Curious how the actual tax bill compared to the estimate going in.

Did a large but not full liquidation a few years back. The estimate was pretty close because all the lots were long-term and covered. The surprise was state tax — federal long-term rates were manageable but my state taxes gains as ordinary income, which added more than I expected.

State treatment is a good point. Some states don't have a preferential rate for long-term gains at all, so the blended rate ends up higher than the federal picture alone suggests.

Form 1040 line 7a is where your net Schedule D result flows, and if you end up with a net capital loss after everything the deductible amount against ordinary income is capped — the exact limit is on Schedule D and in Topic 409 on irs.gov, with any excess carrying forward. I gave Taxr my 1099-B and a list of the lots I was thinking of selling and it built out a worksheet showing the projected Schedule D result under a few different sale scenarios, which made it a lot easier to compare options before committing.

Matt G.

Author

Building a scenario worksheet before committing is exactly what I need. I keep trying to do it in a spreadsheet but the short-term vs. long-term netting rules keep tripping me up.

If this is a large gain, an enrolled agent or CPA who works on investment returns is worth consulting before you place the trades. The tax on a full liquidation can be significant and there may be state-specific strategies (installment timing, estimated payment deadlines) that differ from what people describe in a general forum. Getting the federal picture right is step one, but the state layer can change the math considerably.

Matt G.

Author

I think I'll use the scenario work to get a clear picture first and then bring it to an EA. Thanks for the framing.

Don't forget estimated tax payments. If you liquidate mid-year and your withholding won't cover the resulting gain, you may owe an underpayment penalty. The Form 2210 instructions explain how the safe harbor works. You'd want to make a quarterly estimated payment in the same quarter you realize the large gain rather than waiting until April.

Matt G.

Author

I completely forgot about estimated payments. So I need to pay in the same quarter, not just at filing?

Correct. The penalty is calculated quarter by quarter on Form 2210, not just on what you owe at the end of the year. If your withholding from wages covers the safe harbor threshold the penalty may not apply, but that's a fact-specific calculation based on your prior-year tax and current-year income.

Publication 550 on irs.gov is the main reference for all of this — holding periods, wash sales, how losses net against gains, specific identification. It's long but the investment property chapter is the part that covers what you're describing. Worth reading before you talk to anyone.