Email FacebookTwitterMenu burgerClose thin

How to Avoid Capital Gains Tax on Stocks

SmartAsset maintains strict editorial integrity. It doesn’t provide legal, tax, accounting or financial advice and isn’t a financial planner, broker, lawyer or tax adviser. Consult with your own advisers for guidance. Opinions, analyses, reviews or recommendations expressed in this post are only the author’s and for informational purposes. This post may contain links from advertisers, and we may receive compensation for marketing their products or services or if users purchase products or services. | Marketing Disclosure
Share

Selling stock for more than you paid for it can create a taxable capital gain, but the amount you owe can depend on how long you held the shares, your income and other transactions during the year. Strategies such as holding investments for more than one year, harvesting capital losses, choosing which tax lots to sell and using tax-advantaged accounts can reduce or defer taxes in some situations. Certain strategies, including charitable gifts, inherited-property basis rules and qualified stock exclusions, may potentially eliminate tax on some gains.

If you have questions about taxes and investment planning, consider speaking with a financial advisor.

What Are Capital Gains Taxes?

Capital gains taxes are taxes owed when you sell an asset like a stock for a profit. The tax rates vary depending on how long you held the investment. If you sell it for a loss, you do not owe any taxes on that transaction. So a capital gain on a stock you own would be the profit you receive that is above what you originally paid for it

For example, if you bought one share of John Doe Inc. at $10 and end up selling it for $100, you would have a $90 capital gain. How long you hold that asset will depend on whether the profit is a long- or short-term gain. Here’s a look at the differences between the two types of gains:

  • Short-term capital gains: When you’ve held the stock for one year or less, these are called short-term capital gains. Short-term capital gains are taxed as ordinary income, like the money earned from a job.
  • Long-term capital gains: Long-term capital gains, which come from assets that are sold for a profit after more than a year, receive preferential treatment in the Federal tax code. Long-term capital gains tax rates are lower than ordinary income tax rates.

How Capital Gains Are Taxed on Stocks

The tax rates for the capital gains you earn on your stocks are going to be determined by three factors:

  • Your tax filing status
  • Your taxable income
  • How long you’ve held owned the asset

Here’s a look at how both short- and long-term capital gains are taxed.

Short-Term Capital Gains Tax Rates in 2026

RateSingleMarried, Filing JointlyMarried, Filing SeparatelyHead of Household
10%$0 – $12,400$0 – $24,800$0 – $12,400$0 – $17,700
12%$12,400 – $50,400$24,800 – $100,800$12,400 – $50,400$17,700 – $67,450
22%$50,400 – $105,700$100,800 – $211,400$50,400 – $105,700$67,450 – $105,700
24%$105,700 – $201,775$211,400 – $403,550$105,700 – $201,775$105,700 – $201,750
32%$201,775 – $256,225$403,550 – $512,450$201,775 – $256,225$201,750 – $256,200
35%$256,225 – $640,600$512,450 – $768,700$256,225 – $384,350$256,200 – $640,600
37%$609,351+$768,700+$384,350+$640,600+

Long-Term Capital Gains Tax Rates in 2026

Tax RateIndividualsMarried Filing JointlyHead of HouseholdMarried Filing Separately
0%$0 – $49,450$0 – $98,900$0 – $66,200$0 – $49,450
15%$49,450 – $545,500$98,900 – $613,700$66,200 – $579,600$49,450 – $306,850
20%$545,500+$613,700+$579,600+$306,850+

In addition to the capital gains tax, high-net-worth individuals or high-earners might end up being on the hook for additional taxes for their investment profits. The net investment income tax (NIIT) can add an additional 3.8% tax on top of your capital gains tax if your modified adjusted gross income (MAGI) is above $200,000 for single filers or $250,000 for married filing jointly.

Can You Avoid Capital Gains Tax on Stocks Completely?

It is possible to avoid federal capital gains tax on some stock gains, but many common strategies only reduce or defer the tax rather than eliminate it. The result depends on factors such as your taxable income, how long you owned the shares, your cost basis and what you do with the investment.

For example, holding stock for more than one year can qualify a gain for lower long-term capital gains rates, and some taxpayers may indeed fall within the 0% long-term capital gains bracket. Tax-loss harvesting can reduce taxable gains by offsetting them with investment losses. These strategies can lower a tax bill, but they do not necessarily make every gain permanently tax-free.

Other strategies can potentially eliminate capital gains tax on qualifying appreciation:

  • Donate appreciated stock to charity. If you donate qualifying long-term appreciated shares directly to an eligible charity rather than selling them first, you generally do not recognize the capital gain on the donated shares. A charitable deduction may also be available, subject to applicable rules and limitations.
  • Pass appreciated stock to heirs. Inherited property generally receives a basis based on its fair market value at the owner’s date of death, although exceptions apply. If an heir sells the stock for approximately that value, there may be little or no capital gain attributable to appreciation during the original owner’s lifetime.
  • Qualify for the 0% long-term capital gains rate. Taxpayers whose taxable income falls within the 0% capital gains range may be able to realize some long-term gains without paying federal capital gains tax on that portion.

For example, an investor who bought stock for $20,000 that is now worth $50,000 has a $30,000 unrealized gain. Selling the shares in a taxable account generally realizes that gain. Donating qualifying appreciated shares directly to a charity, by comparison, could allow the investor to avoid recognizing the embedded capital gain on the donated stock, subject to the charitable contribution rules.

Likewise, if stock is inherited with a basis of $50,000 based on its applicable date-of-death value and the beneficiary later sells it for $52,000, the gain would generally be based on the $2,000 increase after the new basis was established rather than the original owner’s purchase price.

The important distinction is that reducing, deferring and avoiding capital gains tax are not the same thing. Investors should consider the tax consequences alongside investment risk, diversification, charitable goals and estate-planning needs rather than making a sale or holding decision based on taxes alone.

10 Ways to Avoid Capital Gains Taxes on Stocks

A taxpayer using a calculator.

There are numerous strategies that investors can implement to reduce or avoid capital gains tax on stocks sold at a profit. Each has its own unique pros and cons that you should take a look at to see if it’s a good fit for your personal situation before moving forward.

Here are 10 common methods that you can incorporate into your financial plan:

1. Invest for the Long Term

When you invest for the long term, you benefit from long-term capital gains rates. These tax rates can be substantially lower than ordinary income tax rates. In 2026, if your taxable income is less than $49,450 as a single filer ($98,900 for married, filing jointly), your long-term capital gains tax rate is 0%.

2. Contribute to Your Retirement Accounts

Investing in retirement accounts eliminates capital gains taxes on your portfolio. You can buy and sell stocks, bonds and other assets without triggering capital gains taxes. Withdrawals from Traditional IRA, 401(k) and similar accounts may lead to ordinary income taxes. However, Roth accounts eliminate taxes entirely on eligible withdrawals.

3. Use a 529 Plan to Sell Stocks and Fund Education

If you plan to use appreciated stock to pay for a child’s or grandchild’s education, consider donating the stock to a 529 plan. While contributions to 529 plans are made with after-tax dollars, the investments grow tax-free and qualified withdrawals for education are not taxed. You can sell stocks in your taxable account, realize gains, and offset them with losses or deductions—then use the proceeds to fund a 529 plan and shift future growth into a tax-advantaged account.

4. Pick Your Cost Basis

When selling your stocks, it is possible to pick your cost basis on the shares that you sell. By handpicking the individual shares, you may be able to avoid capital gains taxes by selling shares that are at a loss (or at least have lower gains), even if your overall position in that investment has made money.

5. Lower Your Tax Bracket

When you have less taxable income, you may qualify for 0% tax rates on long-term capital gains. You can lower your taxable income by being strategic on withdrawals. For example, retirees can make withdrawals from a Roth IRA instead of a 401(k) or traditional IRA, since qualified Roth withdrawals are not taxable in retirement.

Alternatively, you can maximize your deductions by prepaying property tax payments before December 31 or bunching two year’s worth of charitable contributions into one year. Deferring income and maximizing your deductions is another strategy to avoid getting bumped up into a higher tax bracket. Maxing out your company retirement accounts and health savings accounts (HSA) is an excellent way to reduce your taxable income as well.

Run your numbers to see how changes in income could affect your tax bracket.

Income Tax Calculator

Calculate your federal, state and local taxes for the 2025 tax year.

Your 2025 Total Income Taxes

$--

Federal Income & FICA Taxes

$--

State Taxes

$--

Local Taxes

$--

6. Harvest Losses to Offset Gains

Capital losses on investments can offset realized short-term and long-term capital gains. Some investors harvest losses proactively when investments go down in value to offset potential future capital gains. Investors may also offset $3,000 in ordinary income yearly if they have excess capital losses.

7. Move to a Tax-Friendly State

While the state you live in won’t affect your federal taxes owed, moving to a tax-friendly state may help you avoid capital gains tax on stocks when paying state income taxes. Eight states do not charge capital gains taxes: Alaska, Florida, New Hampshire, Nevada, South Dakota, Tennessee, Texas and Wyoming.

8. Donate Stock to Charity

If you have appreciated stock, consider donating the stock instead of cash to your favorite charity. You won’t owe capital gains taxes on the profits when you transfer those shares directly to the charity. Plus, you’ll get a tax deduction based on the current value of the shares instead of the actual amount that you paid for them. And the charity won’t owe taxes either, making it a win-win for both parties.

9. Invest in an Opportunity Zone

The Tax Cuts and Jobs Act created “opportunity zones” that offer tax advantages to investors. By investing in eligible low-income and distressed communities, you can defer taxes and potentially avoid capital gains tax on stocks altogether. To qualify, you must invest unrealized gains within 180 days of a stock sale into an eligible opportunity fund, then hold the investment for at least 10 years.

10. Pass Down Appreciated Assets

When someone passes away, there is a step-up in the cost basis of their assets. This means that the heirs that receive stocks, bonds, real estate and other assets do not owe capital gains taxes if they sell the assets right away. If the assets continue to appreciate after the investor’s death, the beneficiaries will only owe taxes on the appreciation that occurred after their date of death.

Bottom Line

A man calculating how much he could owe in capital gains.

There isn’t one strategy that allows every investor to avoid capital gains tax on stocks. Holding shares for more than one year can qualify gains for preferential long-term rates, while tax-loss harvesting and careful tax-lot selection can reduce taxable gains. Tax-advantaged accounts, charitable gifts, certain qualified small business stock and inherited-property basis rules can provide additional tax advantages when applicable.

Tips for Tax Planning

  • Investors with a financial advisor can work together to reduce or avoid capital gains tax on stocks and other investments. By using their experience and knowledge, a financial advisor can propose steps to minimize the taxes you’ll owe on your stock sales. Finding a financial advisor doesn’t have to be hard. SmartAsset’s free tool matches you with vetted financial advisors who serve your area, and you can have a free introductory call with your advisor matches to decide which one you feel is right for you. If you’re ready to find an advisor who can help you achieve your financial goals, get started now.
  • Capital gains taxes reduce the profits that you’ve earned from your investments. You can properly plan out what your potential liability might be by planning ahead for how your investments might grow. Use our investment calculator to know what your potential increase might be.

©iStock.com/South_agency, ©iStock.com/SrdjanPav, ©iStock.com/Tanja Ristic