Do You Pay Capital Gains If You Reinvest? Stocks, Crypto, Homes

Yes, you generally do pay capital gains tax if you reinvest. In an ordinary brokerage account, selling an investment at a profit is a taxable event on its own, and using the cash to buy something else the same day does not cancel the tax on the sale you just made. A handful of specific structures — 1031 exchanges for real estate, Qualified Opportunity Funds, the primary-residence exclusion, and retirement or 529 accounts — can defer or eliminate the tax, but only when their conditions are met.

Why Reinvesting Doesn’t Erase the Gain

The IRS treats every profitable sale as its own realization. Your gain is the sale price minus your cost basis (generally the original purchase price plus commissions and fees), and it gets reported on Form 1099-B and carried to Schedule D of your return.1Internal Revenue Service. Instructions for Form 1099-B (2026)

Buying a replacement investment right after the sale does one thing: it establishes a new cost basis in the shares you just bought. It does not reach back and undo the profit on the shares you sold. That gain belongs to the tax year of the sale, and you owe on it whether the money is sitting in cash or already back in the market. Missing the payment brings a failure-to-pay penalty of 0.5% of the unpaid balance per month, up to 25%.2Internal Revenue Service. Failure to Pay Penalty

What You’ll Owe in 2026

How much tax hits the gain depends on how long you held the asset. Sell within a year of buying and the profit is a short-term gain, taxed at your ordinary income rate, which reaches as high as 37% in 2026.3Internal Revenue Service. IRS Releases Tax Inflation Adjustments for Tax Year 2026 Hold longer than a year and it becomes a long-term gain, taxed at 0%, 15%, or 20% depending on your income and filing status.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses

The 2026 long-term brackets:5Internal Revenue Service. Revenue Procedure 2025-32

  • 0% on taxable income up to $49,450 (single), $98,900 (married filing jointly), or $66,200 (head of household).
  • 15% above those thresholds up to $545,500 (single), $613,700 (married filing jointly), or $579,600 (head of household).
  • 20% above the 15% thresholds.

A separate 3.8% Net Investment Income Tax may stack on top for higher earners. It applies to the lesser of your net investment income or the amount your modified adjusted gross income exceeds $200,000 for single filers or $250,000 for joint filers. Those thresholds do not adjust for inflation.6Internal Revenue Service. Net Investment Income Tax

Automatic Reinvestment Still Counts

Setting your brokerage to reinvest dividends automatically does not shield you from tax. The dividend is taxable in the year it is paid, and the reinvested amount becomes your cost basis in the new shares.

Mutual fund shareholders can owe tax even without selling anything. When a fund sells holdings at a profit during the year, it passes those gains along as capital gains distributions, which are taxable whether you take the cash or roll them back into more shares. These come on Form 1099-DIV and are treated as long-term gains regardless of how long you personally held the fund.7Internal Revenue Service. Mutual Funds (Costs, Distributions, Etc.)

Swapping One Crypto for Another Is a Sale

Trading Bitcoin for Ethereum is not a tax-free reinvestment. The IRS treats an exchange of materially different digital assets as a realization: your gain equals the difference between your adjusted basis in what you gave up and the fair market value of what you received.8Internal Revenue Service. Frequently Asked Questions on Digital Asset Transactions Even though no dollars leave the exchange, the swap generates a reportable gain or loss on the coin you sold.

When Reinvesting Does Defer or Eliminate the Tax

A few specific structures actually deliver the “reinvest and skip the tax” outcome many investors have in mind. Each has strict conditions.

1031 Like-Kind Exchanges (Real Estate Only)

Under Internal Revenue Code Section 1031, an investor can swap one investment property for another and defer the capital gains tax, carrying the old basis forward into the new property. The rule covers real property held for business or investment. Personal residences do not qualify.9Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment

Two deadlines run from the day you close on the original property. You have 45 days to identify a replacement in writing, and 180 days (or your tax return’s due date with extensions, if earlier) to close on it.9Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment The proceeds must be held by a Qualified Intermediary in the meantime; if you take control of the cash, the exchange fails and the gain becomes taxable. The exchange is reported on Form 8824, and any cash or non-like-kind property you receive in the deal (“boot”) is taxable even if the rest qualifies.10Internal Revenue Service. About Form 8824, Like-Kind Exchanges

Qualified Opportunity Funds

Qualified Opportunity Funds, created by the Tax Cuts and Jobs Act of 2017, let you defer tax on a capital gain by reinvesting the gain portion (not the whole principal) into a fund that invests in designated low-income communities.11Internal Revenue Service. Opportunity Zones You have 180 days from the sale that produced the gain to make the investment.12Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones

The deferred gain becomes taxable on the earlier of the date you sell your fund interest or December 31, 2026.13Internal Revenue Service. Opportunity Zones Frequently Asked Questions No new deferral elections can be made for sales occurring after December 31, 2026.12Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones The bigger benefit is separate: hold the fund interest for at least ten years and you can elect to step up your basis in the fund investment to its fair market value on sale, making the appreciation on the fund itself effectively tax-free.

Selling Your Primary Home

When you sell your main home, you can exclude up to $250,000 of gain from income, or $500,000 if married filing jointly.14Internal Revenue Service. Topic No. 701, Sale of Your Home Reinvesting the proceeds in another home is not required. To qualify, you must have owned and used the property as your principal residence for at least two of the five years leading up to the sale.15Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence For joint filers, only one spouse needs to meet the ownership test, though both must meet the use test. This is an exclusion, not a deferral — the gain is permanently gone from your income up to the limit, and anything above the cap is taxed at the applicable capital gains rate. You generally cannot use the exclusion more than once every two years.

Retirement and Education Accounts

Inside a 401(k), IRA, or 529 plan, you can sell and reinvest freely without triggering capital gains tax. The tax event is shifted to the point of withdrawal, so buying and selling within the account produces no annual bill and the full balance compounds.

Moving money between retirement accounts of the same type keeps the tax-deferred status intact. A direct trustee-to-trustee transfer is the cleanest route. If the distribution is paid to you instead, you have 60 days to deposit it into another qualifying account, and retirement plan distributions paid directly are subject to a mandatory 20% withholding.16Internal Revenue Service. Rollovers of Retirement Plan and IRA Distributions Pulling money out of a retirement account before age 59½ generally triggers ordinary income tax plus a 10% early withdrawal penalty, with limited exceptions.17Internal Revenue Service. Retirement Topics – Exceptions to Tax on Early Distributions

A 529 plan works on the same principle: gains grow tax-free, and qualified withdrawals for college costs (or up to $10,000 per year in K-12 tuition) come out untaxed. Non-qualified withdrawals face income tax and a 10% penalty on the earnings.18Internal Revenue Service. 529 Plans – Questions and Answers

Don’t Forget State Tax

Federal is only half the picture. Most states tax capital gains as ordinary income, with rates ranging from 0% in states with no income tax to roughly 13–14% at the top. The federal deferral tools generally carry over to state returns, but some states impose extra requirements or do not fully conform to federal rules, so check with your state tax agency before assuming a federal deferral works the same way at the state level.