If you’re among the 62% of Americans who are invested in the stock market, your shares have likely increased in value overall for years. Stock appreciation creates value for you as an investor but also results in new responsibilities.
When you sell appreciated stock, you pay a federal tax on the gains, called capital gains tax. As of 2024, you pay anywhere from 0% to 20% in capital gains taxes when you sell appreciated stock, and typically even more if you’ve only held the stock for a short time.
Many people rely on investments to build retirement, supplement their income, and build wealth, so they naturally want to minimize the impact of capital gains taxes on their transactions. How?
There are several key strategies (some very easy) to avoid unnecessary capital gains taxes. We’ll start with the easiest and work our way down to the more strategy-intensive options:

- Donate stock to charity.
 - Hold stock shares for more than one year.
 - Invest in retirement accounts.
 - Pass it on in your estate plans.
 - Sell stocks when you’re in a lower tax bracket.
 - Offset your capital gains with losses (aka tax-loss harvesting).
 - Reset your cost basis through donating plus open market buying.
 
The information in this article is provided for educational purposes only and should not be construed as providing legal or tax advice. This information is general in nature and is not intended to serve as the primary or sole basis for investment or tax-planning decisions.
1. Donate stock to charity.
If you’ve never done it before, donating stock to charity might sound complicated.
Thankfully, the process is easy, especially with tools like FreeWill that streamline every step for you and the organizations you choose to support.
Donating stock to charity is a mutually beneficial way to give. Nonprofits receive stock that they can hold or liquidate for cash, and they’re generally exempt from capital gains taxes, meaning they keep the full value of the shares. These gifts are also typically unrestricted, so nonprofits can put the funds towards their most pressing operational needs that might otherwise receive little attention from donors.
But what benefits do you see as a stock donor? Take a look:
Benefit #1: You can avoid paying capital gains tax.
When you donate appreciated stock, you don’t have to pay capital gains tax because you never technically sold the stock or received the gains. And because nonprofits are typically exempt from these taxes, too, the full value of the stock you donate can go to your favorite cause.
Benefit #2: You may qualify for income tax deductions.
When you file your taxes, you may be able to claim an income tax deduction for the value of the shares you donated. This is one way to lower your taxable income and potentially pay less in income tax. Learn more with our quick guide to tax deductions for stock donations.
Benefit #3: You’re exempted from certain rules and can rebalance your portfolio.
In later sections, we’ll take a look at two specific (but slightly more complicated) investing strategies. In one (tax-loss harvesting), you can amplify your tax savings through stock donations. In the other (cost basis resets and open market buying), you can reduce immediate taxes and save in the long term through a rule exemption enabled by donations.
For savvy investors or those who work with investment advisors, these strategies can deliver a lot of long-term value, so they’re worth exploring.
So how do stock donations work? To donate stock, first check out FreeWill. Our platform modernizes the process and minimizes the amount of back-and-forth needed between you, your broker, and your chosen nonprofit.

Take a look at our guide to stock donations or browse the supported nonprofits on our stock giving tool to learn more.
2. Hold stock shares for more than one year.
When you sell stock, the amount you pay in taxes will depend on how long you’ve owned the shares:
- If you’ve held the shares for more than a year, they’re considered long-term gains and are taxed at a lower rate.
 - If you’ve held them for a year or less, they're considered short-term gains, and they’ll be taxed at your regular income tax rate (which is higher).
 
The exact amount you’ll pay in taxes depends on which tax bracket you’re in and your tax filing status.
For example, let’s say you’re in the median tax bracket — which means you pay 24% in income tax — and that you’re married filing jointly. You decide to sell 100 shares of stock for a $10,000 gain:
Gain made on stock saleFederal tax rateAmount paid in taxesAmount received after taxesShort-term gain$10,00024% (income tax rate)$2,400$7,600Long-term gain$10,00015% (capital gains tax rate)$1,500$8,500
If you hold these stocks for more than a year before you sell, your tax savings are significant. You’d save $900 in taxes by simply waiting to sell, compared to if you’d sold earlier.
3. Invest in retirement accounts.
Employer-sponsored retirement accounts — including (401(k)s, Individual Retirement Accounts (IRAs), and even Health Savings Accounts (HSAs) — are tax-advantaged investments.
You can choose to either pay taxes when you contribute (known as a Roth account), or pay taxes when you withdraw (known as a traditional account). Whichever you choose, in the years you have your account, you can buy and sell stocks within your portfolio and not pay any capital gains tax. Although these accounts have contribution limits, you're free to buy and sell with the funds already in the account, regardless of how much they grow.
The money you may have otherwise paid in taxes can instead be reinvested, allowing you much greater gains throughout your lifetime. Automate withdrawals from your paychecks or other income, and grow your capital gains until you're ready to cash out.
4. Pass it on in your estate plans.
Estate planning isn’t a tactic you can capitalize on during your lifetime, but it can greatly benefit your loved ones who inherit your stock.
This is because of a concept called “step-up in basis.” This section of the U.S. Internal Revenue Code states that the cost basis (i.e., the purchase price of an asset) is automatically reset to its fair market value at the time of the original shareholder’s death.
In most cases, this means the cost basis of inherited stock is increased to its fair market value at the time of the original shareholder's death. In practice, this means the inheritor’s capital gains tax burden when they sell the stock is reduced, potentially much lower than it would be otherwise.
If an inheritor isn’t interested in holding onto a particular stock for whatever reason, they can sell shares very shortly after receiving the inheritance. There’s no rule for how long heirs have to hold their inherited shares before they can sell.
The fair market value of the stock is unlikely to have drastically changed between the original shareholder's death and the time of sale, so the step-up in basis could potentially help the heir avoid paying almost any capital gains tax at all.
Here’s an example scenario:
- Let’s say that 20 years ago, you purchased 10 shares of ABC Co. for $10 a share (a $100 investment). Today, those shares are worth $100 each, so $1,000 total.
 - If you decide to sell those shares, you’d pay capital gains tax on your $900 earnings.
 - However, if you held those shares until you passed away and gifted them to your child in your will, their cost basis would be reset to today’s purchase price of $100 a share.
 - As a result, your heir could then immediately sell those shares to realize their current value and not pay any capital gains tax.
 
Don’t have a will yet? FreeWill can help with that, too. Create or update your last will and testament at any time—it’s simple and 100% free. Get started today, or learn more about the basics of estate planning on our blog.
5. Sell stocks when you’re in a lower tax bracket.
When you’re in a lower tax bracket, you pay less in capital gains tax. It’s not always possible to drop into a lower tax bracket, but there are some strategies you might be able to use to lower your taxable income:
- Bunch your deductions. If you itemize your deductions on your tax return, consider bunching as many deductions as possible into one tax year. This could include healthcare costs, property taxes, charitable donations, and more. Depending on your situation, you may be able to lower your taxable income enough to drop into a lower tax bracket for that year.
 - Wait to sell. If you don’t need the money now, consider waiting to sell your stocks until a time when your income is lower, such as after retirement. This will reduce your capital gains taxes and give you added liquidity, but you’ll need to plan carefully (potentially with your financial planner or investment advisor) to make sure this strategy goes smoothly.
 - Donate stock to charity. Donating shares of stock to charity is another way to lower your taxable income for the year. It can also provide several other tax benefits, as discussed above. Learn more about the tax benefits of stock donations and explore FreeWill’s stock giving tool to see the process in action.
 
6. Offset your capital gains with losses (also called “tax-loss harvesting”).
Tax-loss harvesting is the process of offsetting your capital gains with capital losses. This means that if you sell shares of stock at a lower price than you bought them, the amount of that loss is deducted from the capital gains tax you owe.
It works like this:
- Identify shares in your portfolio that have decreased in value since you purchased them.
 - Sell those shares and take the capital loss, which you can claim as a deduction.
 - Then, use the cash proceeds from the sale to invest in a similar asset.
 - Or try it the other way around — realize a capital gain but then sell a different asset at a loss to reduce the overall tax bill.
 
For example, say you sell ten shares of ABC Co. for a $10,000 gain and are taxed 20%. You would owe $2,000 in capital gains tax. If you also decided to sell ten shares of XYZ Inc. for a $4,000 loss, that amount would essentially be deducted from your $10,000 gain. This means only $6,000 of your gains would be taxed, resulting in an $800 tax savings for you that can be saved or put towards a new investment.
Financial advisors and robo-advisors commonly use tax-loss harvesting to optimize returns, but it’s possible to use this strategy on your own with some careful planning and financial know-how. You’ll also need to understand the Wash-Sale Rule — see the final strategy below to learn more.
Benefits of tax-loss harvesting when donating stock
Take tax-loss harvesting a step further and maximize your tax savings by incorporating charitable donations.
Let’s say you already know you want to donate stock to support a nonprofit, avoid capital gains taxes, and/or fine-tune your portfolio. As we’ve seen, there are a few ways you might do this. For some donors, tax-loss harvesting offers the biggest benefits.
Let’s compare the common approaches you might take:
- Tax-loss harvesting and donating
 - Holding the stock and donating it directly
 - Selling at a loss and then donating cash
 - Selling at a gain and then donating cash
 
In this scenario, imagine you purchased $10,000 of a total stock market ETF that has significantly fallen in value in the past few months. Here’s how each approach would roughly play out for you:
StrategyTaxes AvoidedDeduction for DonationTotal Tax SavingsTax-loss harvest & donate$2,890$12,000$14,890Donate the stock directly$740$11,260$12,000Sell at a loss & donate cash$1,225$7,500$8,725Sell at a gain & donate cash-$740$11,260$10,520
Let’s take a closer look at how they’d work:
- In the first option, you sell the losing shares for a total capital loss (and deduction) of $2,500. This amount will be reported on your taxes and reduce your income for the year. For some earners, you can get up to 49% of the loss back on your tax return; in this case, you could receive $1,225 in tax credits.
- That same day, you purchase $7,500 of a different ETF with a similar composition and that has seen similar performance. These shares increase in value to $12,000 over the next year, representing a capital gain of $4,500. You then decide to donate these shares to charity and avoid the tax you’d pay if you sold (roughly $1,665). Avoiding these taxes — plus the initial tax credit of $1,225 — totals $2,890 in tax savings.
 - By following all the steps of this process, you’ve locked in three tax benefits: tax-loss harvesting, avoidance of capital gains through donating, and direct tax deductions through donating. You’ll get the full $12,000 deduction for the donation, save $1,665 in capital gains tax, and receive $1,225 in tax credits for the tax-harvested loss.
 
 - In the second option, you hold your original $10,000 ETF investment until it recovers its losses and appreciates to $12,000. If you donate this stock, you save $740 in potential capital gains tax on the $2,000 gain. You’ll also be able to write off the full $12,000 on your taxes as a charitable contribution.
 - In the third option, you sell your losing ETF holding and donate the cash to charity. You’ll be able to claim the capital loss and receive tax credits up to $1,225. The charity receives the current cash value of the holding, $7,500, which you can claim as a charitable deduction.
 - In the fourth option, you sell the ETF holding and donate the cash after it’s appreciated to $12,000. You’ll then need to pay a capital gains tax of $740. This would result in the charity receiving a total of $11,260 (and you claiming a charitable deduction of the same amount).
 
Tax-loss harvesting offers a highly beneficial (albeit more complex) way to reduce your tax bill. Mixing in donations adds another layer of benefits: additional tax savings for you and extra support for charities in your community.
You’re in the best position to identify the right approach for your unique goals, needs, and current performance. The key is to understand your options. Do your research or work with your financial planner or investment advisor if you want to develop a tax-loss harvesting strategy.
And if you want to incorporate charitable giving into your strategy, make sure to save all the necessary documentation for your gifts! You should also understand your repurchasing options after executing a loss-harvesting strategy, as we’ll explain below.
7. Reset your cost basis through donating plus open market buying.
Timing a stock donation with open market buying of the same stock you just donated can lead to tremendous tax savings. This strategy can be over 3 times more tax-efficient than other approaches.
What does it mean in practice? First, it's important to understand the Wash-Sale Rule.
The Wash-Sale Rule
The Wash-Sale Rule states that if you sell stock at a loss and claim the capital loss on your taxes (either as a straightforward reduction of income or as part of a loss-harvesting strategy), you have to wait at least 30 days before repurchasing an identical stock.
This is to prevent investors from evading tax laws and abusing their tax-loss harvesting options.
There’s one big exception, though: Donating stock exempts you from the Wash-Sale Rule.
As we’ve seen, stock donations can amplify your loss-harvesting strategy. But stock donations can also give you a lot of added flexibility. Exemption from the Wash-Sale Rule means that you can repurchase stock that has played an important role in your portfolio and tap into the benefits of loss-harvesting. It also means you can experience long-term benefits through resetting your stock’s cost basis.
Resetting your cost basis and its long-term benefits
Your “cost basis” is the original price you paid for a share of stock. When you sell stock that has increased in value, you have to pay tax on that increase. If you’ve had shares of stock in your portfolio for years, its value has likely grown a lot — which means you could owe a lot in capital gains tax.
But if you decide to donate those shares instead, you could immediately buy new shares of that stock at today’s higher purchase price.
You might approach this process as preemptively spending the amount you’ve saved on taxes via the donation or as a straightforward out-of-pocket expense. Either way, here’s what you’ve accomplished:
- You’ve maintained the composition of your investment portfolio.
 - You’ve reset the cost basis of the donated/purchased stock at a higher value, meaning any capital gains later calculated on a sale of that stock will be lower than they would if you’d held them the entire time.
 
Here’s an example scenario:
You bought shares of ABC for $3,000 in January 2023. By February 2024, those same shares are worth $6,500 on the open market. You also know that you want to make a charitable contribution.
Instead of giving cash, you make your donation of $6,500 using the appreciated stock. That same day, you use $6,500 cash to purchase the same number of ABC shares that you just donated.
Three things happened here:
- You made a donation worth $6,500, which the charity keeps when they sell the stock.
 - You can deduct the full $6,500 as a donation on your tax return.
 - Your ABC shares are now taxable at a higher cost basis.
 
Eventually, you decide to sell these shares. If the stock remains at the current price, you’ll pay no taxes. If the stock value appreciates, your taxes will be based on the appreciation from $6,500, not from the original $3,000 cost. If the stock value falls, you’ll get all of the loss deduction benefits from the new adjusted cost of $6,500 (up to a 49% credit of the capital loss).

These graphs visualize the difference that a cost basis reset can make on your tax bill. Before making a gift, the cost basis is locked in $3,000, creating a larger capital gain if the stock is held the entire time. After making a gift and then repurchasing the stock, the cost basis is reset higher at $6,500. Future capital gains taxes will therefore be smaller, and deductible losses from depreciation will be larger.
To sum up, with some simple strategizing, you can avoid paying capital gains tax, take a larger deduction from charitable donations, and set yourself up for long-term success with new shares.
This is an excellent strategy for anyone who wants to donate stock while maintaining the asset balance of their portfolios. Remember, using a stock donation service such as FreeWill makes the process as simple as donating cash.
The bottom line
Stocks are an important part of many Americans’ financial portfolios. And when it comes to reducing capital gains tax, a little planning can go a very long way.
That said, tax law can be complicated. If you have questions about your stock portfolio, consider working with a financial advisor or a qualified tax professional.
If you’re interested in saving on your taxes and making a difference by donating stock to charity, consider using FreeWill’s free online stock donation platform. It streamlines the donation process by auto-filling the information you need for your brokerage’s forms, so you can make your gift in just 10 minutes. All of your data is protected with bank-level encryption. And we’ll never charge you a fee to make your stock donation, so 100% of your gift goes directly to the causes you care about.
To learn more about how donations can help you optimize your tax strategy, explore these additional resources:
Make your free estate plan today

Make your free advance healthcare directive

Make your free durable power of attorney

Make a stock donation today

Make your free revocable living trust







