Skip to content

A Guide to Capital Gains Tax on Selling Stock to Buy a House

Your portfolio has grown for years. Now you want to use part of it to buy a home, and the first question is how much of the sale goes to taxes.

The answer depends on how much you sell. A buyer who pays cash sells the most stock and reports the largest gain. A buyer who finances part of the purchase sells less.

Financing is not automatically the better choice. A mortgage adds interest, and the tax on shares you keep is postponed, not erased. The useful comparison is the tax you would pay today against the cost of borrowing.

How Capital Gains Tax Works When You Sell Stock to Buy a House

Selling stock in a taxable account creates a capital gain or loss. The gain is the sale price minus what you paid for the shares.

Shares held for more than 1 year generally receive long-term federal rates of 0%, 15% or 20%, depending on your taxable income. Shares held for 1 year or less are generally taxed at ordinary income rates.

Higher earners may also owe the 3.8% net investment income tax, and many states tax the gain as well. What you do with the proceeds does not change the calculation.

Why Buying a Home Does Not Offset Capital Gains on Stock

Several real estate tax rules sound as though they should help. In general, they apply to real estate you sell, not to stock you sell to buy real estate.

  • The home sale exclusion. The exclusion of up to $250,000, or $500,000 for married couples filing jointly, applies to gain on the sale of a main home. It does not apply to gain on stock.
  • Like-kind exchanges. These exchanges are limited to real property held for investment or business use. Stock does not qualify.
  • First-time buyer status. Being a first-time home buyer does not reduce capital gains tax on shares sold for the down payment.

The gain on the stock is generally taxable in the year of the sale. Have your CPA confirm how the rules apply to you.

Ways to Reduce Capital Gains Tax on a Stock Sale

You may not be able to eliminate the tax, but several choices can lower it.

  • Hold for more than 1 year. Long-term rates are generally lower than ordinary income rates.
  • Choose which shares to sell. Shares bought at higher prices carry smaller gains than shares bought years ago.
  • Use losses. Losses on other positions may offset gains realized in the same year.
  • Consider the calendar. Dividing a sale between 2 tax years may change the rate applied to part of the gain.
  • Sell less. Financing more of the purchase means fewer shares sold and a smaller gain reported.

The first four are decisions for you and your CPA. The fifth is a mortgage decision, and it often moves the largest dollar amount.

Financing a Home Purchase to Sell Less Stock

Consider a Naples buyer purchasing a $3 million home. The buyer's shares were purchased for 40% of their current value, so 60% of every dollar sold is gain. Assume a 20% federal rate and the 3.8% net investment income tax both apply.

  Paying cash 30% down with a mortgage
Stock sold for the purchase $3,000,000 $900,000
Taxable gain $1,800,000 $540,000
Estimated federal tax $428,400 $128,520
Mortgage None $2,100,000

The financed purchase reports approximately $299,880 less federal tax in the year of the sale. The amounts are an illustration, and they exclude state tax and the additional shares either buyer would sell to pay the tax itself.

The savings come with a cost. The buyer now has a $2.1 million mortgage and pays interest on it. The remaining shares still carry their gain, and tax may be due whenever they are eventually sold. The same tradeoff applies to anyone weighing whether to sell stocks to buy a house at a lower price point.

State Capital Gains Tax Examples for Home Buyers

The Naples buyer owes federal tax only, because Florida has no personal income tax. Buyers in many other states owe state tax on the same gain, and most of those states tax capital gains as ordinary income.

The examples below are hypothetical. Each assumes the same 23.8% combined federal rate used above and, for simplicity, a single state rate on the entire gain.

Newport Beach, California: A $5 Million Purchase

A founder who sold a company holds shares worth twice what they cost. Paying cash means selling $5 million of stock and reporting a $2.5 million gain. Assume a 13.3% state rate. The federal tax is $595,000 and the state tax is $332,500, a total of $927,500.

With 30% down, the founder sells $1.5 million and reports a $750,000 gain. The total estimated tax is $278,250. The $3.5 million balance is financed, and asset depletion loans in California are a common way to qualify for it.

Short Hills, New Jersey: A $2.5 Million Purchase

A couple leaving Manhattan holds index funds bought for 40% of their current value. Paying cash means selling $2.5 million and reporting a $1.5 million gain. Assume a 10.75% state rate. The federal tax is $357,000 and the state tax is $161,250, a total of $518,250.

With 20% down, the couple sells $500,000 and reports a $300,000 gain. The total estimated tax is $103,650. The remaining portfolio can support the $2 million mortgage through asset depletion loans in New Jersey.

Winnetka, Illinois: A $2 Million Purchase

A retired executive holds company stock worth twice its cost. Paying cash means selling $2 million and reporting a $1 million gain. Assume a 4.95% state rate. The federal tax is $238,000 and the state tax is $49,500, a total of $287,500.

With 25% down, the executive sells $500,000 and reports a $250,000 gain. The total estimated tax is $71,875. The lower state rate narrows the gap, but the federal tax still drives the decision for buyers using asset depletion loans in Illinois.

Florida and Texas: No State Income Tax

Buyers who live in Florida or Texas owe no state income tax on the gain. The federal tax is unchanged, so the comparison still matters for asset depletion loans in Florida and asset depletion loans in Texas.

State tax generally follows where you live when you sell, not where the new home is located. Buyers relocating from a higher-tax state should ask their CPA about the timing of any sale.

Market Home price Estimated tax paying cash Estimated tax with a mortgage
Newport Beach, California $5,000,000 $927,500 $278,250
Short Hills, New Jersey $2,500,000 $518,250 $103,650
Winnetka, Illinois $2,000,000 $287,500 $71,875
Naples, Florida $3,000,000 $428,400 $128,520

Actual tax depends on your income, filing status, holding period and state rules. In every example the buyer who finances also takes on a mortgage and its interest cost.

Qualifying for the Mortgage With an Asset Depletion Loan

The plan works only if the buyer can qualify for the $2.1 million loan. Many investors with large portfolios report modest income, and a conventional approval is based on income.

An asset depletion mortgage uses the portfolio instead. The lender takes eligible assets, counts a percentage set by the program and divides the result over a fixed number of months. The monthly figure becomes qualifying income, and the accounts stay invested.

Assume the Naples buyer has $5.8 million remaining after the down payment, closing costs and taxes. Assume the lender counts 70% of the balance and divides it over 120 months. The calculation is $4,060,000 divided by 120, or $33,833 per month.

Assume the full housing payment and other debts total $15,500 per month. The debt-to-income ratio is 45.8%. The buyer still needs to satisfy the program's credit, reserve and property requirements, and lenders differ on asset depletion mortgage requirements such as account types and documentation.

Purchases at this size generally call for a jumbo asset depletion loan. The same structure is used for asset depletion loans in Colorado and other states where buyers hold large portfolios.

Capital Gains Tax on Crypto Used for a Home Purchase

Digital assets are generally treated as property for federal tax purposes. Selling Bitcoin or another cryptocurrency to fund a purchase generally creates a gain or loss in the same way a stock sale does.

Long-time holders often have a very low cost basis, so most of the sale may be gain. A crypto mortgage may count eligible holdings toward qualification for qualified borrowers without requiring the cryptocurrency to be sold or pledged as collateral.

The down payment and closing costs must still be paid in dollars. Any crypto converted for those funds is a sale.

Comparing the Cost of Selling and the Cost of Borrowing

A lower tax bill this year is one side of the decision. The other side deserves the same attention.

A mortgage carries interest for as long as the balance is outstanding. Pricing on an asset depletion mortgage may be higher than on a conventional loan. The portfolio you keep can fall in value as well as rise.

Some buyers plan to hold their shares for decades. Others expect to sell within a few years and would only be moving the tax to a later date. Your time horizon, the size of the gain and your comfort with a monthly payment all matter.

Buyers who decide to leverage a portfolio to buy a house should run the tax estimate and the loan estimate side by side.

Capital Gains Tax and Home Purchase FAQs

If I sell stocks to buy a house, do I pay capital gains tax?

Generally, yes. Gain on stock sold in a taxable account is taxable regardless of how the proceeds are used.

Do first-time home buyers get a capital gains break on stock?

Generally, no. First-time buyer programs relate to the mortgage and down payment, not to the tax on shares you sell.

Does the $250,000 or $500,000 exclusion apply?

The exclusion applies to gain on the sale of a main home that meets the ownership and use rules. It does not cover gain on stock.

Does a mortgage eliminate the capital gains tax?

No. A mortgage reduces how much you need to sell today. Tax may still apply to the remaining shares when you sell them.

Is an asset depletion mortgage the same as borrowing against my portfolio?

No. A securities-backed line pledges the account as collateral. An asset depletion mortgage is secured by the home and uses the accounts only to calculate income.

Why Working With a Mortgage Broker Matters

The tax estimate belongs to your CPA. The loan estimate depends on which lender reviews the file.

One program may divide the Naples buyer's assets over 120 months. Another may use 84 months, which raises qualifying income to $48,333 and lowers the ratio to 32.1%. A third may count a different share of each account. Guidelines vary widely among asset depletion mortgage lenders.

A single lender offers one calculation. A mortgage broker compares several and shows how each down payment changes both the loan and the amount of stock you need to sell.

Why Work With LendFriend Mortgage

LendFriend Mortgage is an Austin-based mortgage broker with access to more than 40 wholesale lenders. The team arranges asset depletion mortgages, crypto mortgages and jumbo financing for purchases and refinances.

LendFriend prepares the financing side of the comparison before you sell. You and your CPA can then weigh the loan terms against the tax on each amount of stock.

The Bottom Line

Selling stock to buy a house generally creates a taxable gain, and buying the home does not offset it. The amount you sell is the part you control.

Financing more of the purchase can reduce the gain you report this year. It also adds a mortgage payment and leaves the tax on the remaining shares for a later date. Compare both before you decide.

Get in touch with me by completing this quick form to discuss your options.

About the Author:

Eric Bernstein is the President and Co-Founder of LendFriend Mortgage, where he helps homebuyers make smarter, more confident decisions in today’s fast-moving housing market. With over a decade of experience guiding hundreds of clients—from first-time buyers to seasoned investors—Eric brings a mix of market insight, strategy, and personalized service to every mortgage transaction. Each week, Eric breaks down the housing and economic headlines that matter, giving readers a clear, no-fluff view of what’s happening and how it might impact their buying power.