Should you sell stocks before buying a house?
If you expect to close on a home within about a year, selling the stocks earmarked for the down payment and holding the cash is the usual approach. Stocks suit goals that are a decade or more away. Over a few months, prices can fall sharply for reasons that have nothing to do with your closing date.
The tradeoff is simple. You give up possible further gains in exchange for knowing the money will be there on closing day. For a fixed deadline, a missed gain is an annoyance, while a shortfall can cost you the house or force you to borrow more.
How big is the timing risk?
A market drop in the final months can erase a meaningful part of a down payment, and you cannot wait for a recovery because the closing date is fixed. Here is the arithmetic on a $60,000 down payment:
- A 15% decline leaves $60,000 x 0.85 = $51,000, a $9,000 shortfall.
- A 10% decline leaves $54,000, a $6,000 shortfall.
Over ten or twenty years, stock prices have tended to rise. Over three to twelve months, the direction is close to a coin flip, which is why this money is a poor fit for stocks. For more on protecting money you cannot afford to lose, see How to Preserve Capital When Markets Get Scary.
Common places to hold near-term cash are a high-yield savings account, a money market fund, or short-term Treasury bills. Each has different safety features, so check how your bank or fund is protected before you move a large sum.
How are gains taxed when you sell?
Your gain is the sale price minus your cost basis (what you originally paid), and the tax rate depends on how long you held the shares. Using the IRS 2026 inflation adjustments:
| Holding period | Tax treatment | 2026 federal rate, single filer |
|---|---|---|
| One year or less | Short-term capital gain | Ordinary income rates, 10% to 37% |
| More than one year | Long-term capital gain | 0% up to $49,450; 15% up to $545,500; 20% above |
For married couples filing jointly in 2026, the long-term thresholds are 0% up to $98,900, 15% up to $613,700, and 20% above that. The thresholds apply to taxable income, which is your income after deductions, not your salary.
Two extras can apply. Higher earners may owe a 3.8% net investment income tax when modified adjusted gross income passes $200,000 (single) or $250,000 (joint). Most states also tax gains separately.
There is no exemption for spending the proceeds on a home. The tax is the same whatever you do with the cash.
Does waiting a few weeks change the tax?
Yes, if a lot of shares is close to its one-year anniversary. The holding period counts from the day after you bought the shares to the day you sell them, and you need to hold for more than one year to get long-term rates.
Suppose you have a $20,000 gain and your marginal ordinary rate is 24%. Sold early, the tax is about $4,800. Sold after the one-year mark at 15%, it is $3,000. That is a $1,800 difference from waiting a few weeks, which may be worth it if your closing date allows and you are comfortable with the market risk over that short stretch.
How to choose which shares to sell
If you bought the same stock at different times and prices, each purchase is a tax lot. Most brokerages let you pick specific lots instead of the default method.
A lot with a small gain or a loss creates less tax than a lot with a large gain. Holding periods matter too: a long-term lot is usually taxed more lightly than a short-term one. Set the lot selection before you place the sale, because it is often hard to change afterward.
If you hold a large amount of a single stock, see Concentrated Stock Positions for why selling it may reduce risk as well as raise cash.
Can losses offset the tax?
Yes. Capital losses first offset capital gains of the same kind, and then the other kind. If losses exceed gains, up to $3,000 a year ($1,500 if married filing separately) can reduce other income, and the rest carries forward to future years, according to the IRS.
Selling a losing holding in the same year is called tax-loss harvesting, and Tax-Loss Harvesting Explained covers the mechanics. Watch the wash sale rule: if you buy the same or a substantially identical security within 30 days before or after the sale, the loss is disallowed for now.
What about using a retirement account?
Treat retirement accounts as a last resort. Withdrawals from a 401(k) or traditional IRA are generally taxed as ordinary income, and withdrawals before age 59 and a half usually add a 10% additional tax unless an exception applies.
One exception is a first-time homebuyer withdrawal from an IRA, which avoids the 10% additional tax up to $10,000 over your lifetime, but the income tax still applies on traditional money. Rules differ for 401(k) plans, so check your plan and a tax professional before taking money out. Beyond the tax, you also lose years of compounding on that money.
Worked example: $60,000 position, two paths
You hold $60,000 of stock that cost $40,000, a $20,000 gain, all held more than one year. You expect to close in five months. You are a single filer with $90,000 of other taxable income, so the gain falls in the 15% bracket.
Path 1, sell now and hold cash. Federal tax is $20,000 x 15% = $3,000. You keep $57,000 for the down payment, before any state tax and ignoring any interest earned.
Path 2, stay invested and sell at closing. If the market falls 12% in the meantime, the position is worth $52,800. The gain is now $12,800 and the tax is $12,800 x 15% = $1,920, leaving $50,880.
The gap is $57,000 minus $50,880 = $6,120. If the market had risen, Path 2 would have come out ahead, but the plan would have depended on luck for money with a fixed deadline.
When this advice does not apply
The one-year rule of thumb is not a law. A few situations change it:
- Flexible timeline. If you can delay the purchase for years, you may reasonably keep some money invested.
- Large cushion. If your down payment is far more than you need, only the required amount must be protected.
- Very low-income year. If your taxable income puts the gain in the 0% bracket, selling may cost nothing in federal tax.
- Cash rates. Interest on savings is taxed as ordinary income, which is a small cost of holding cash.
What this means for you
If you have a regular job and a brokerage account, a short checklist handles most of it.
- Write down your expected closing date and the exact amount you need.
- Once the purchase is within about a year, decide how much of that amount to move to cash.
- Open your brokerage's tax lot view and note each lot's purchase date, cost basis and gain.
- Check which lots cross the one-year mark before closing, and weigh waiting against market risk.
- Estimate the federal and state tax and subtract it from the proceeds before making offers.
- Keep retirement accounts out of the plan unless nothing else works, and talk to a tax professional first.
This is general education, not tax or investment advice, and your own situation may differ.