How to Reduce your Capital Gains Taxes when Selling a Stock

jehericoplungeRight now, given the sell off in the stock market last week, you may have a stock that you still really like but that has declined in price, creating a loss.  You may also have a stock that you have held for a long time while the company has grown, and therefore have a big gain.  Maybe you want to trim back your winning position in this second company a bit because it is getting to become to large a portion of your portfolio, but doing so would cause a big gain and capital gain taxes.  Luckily, there is a way that you can take advantage of the market downturn to trim the position but cut or eliminate capital gains taxes.

For example, I have shares of Home Depot (HD) that I have held for quite a while, having bought in when the stock was in the mid $30’s.  The stock is currently trading at $119, so I would be realizing a gain of about $85 per share if I sold today.  Because the position has done so well, however, the value has grown considerably.  I also have concerns that Home Depot is becoming a very large company and may have trouble growing at the rate it has in the past in the years to come.

I also bought shares of railcar maker, Greenbrier (GBX),  when they were in the $40s.  They are now trading at about $22 since the decline in the price of oil may cause less demand for the oil-carrying railcars they produce.  I believe in the company long-term, however, both because they make a lot of other types of train cars and rail transportation will grow as the economy picks up speed due to lower energy prices and there is more shipping and because eventually oil prices should recover somewhat since there are always boom and bust cycles in commodities.  I therefore don’t want to sell my position in the company.

One strategy I could take is to sell some of my Home Depot shares and use the money to buy more shares of Greenbrier.  For example, if I sold 100 shares of Home Depot, I could buy about 550 shares of Greenbrier at the current prices.  I could then hold the extra shares in Greenbrier for a couple of months, hoping for something of a recovery during the time, then sell off 550 of the original shares I held, taking a loss.  Note that it is important that I wait a period of time after buying the new shares before I sell the old ones or the IRS will consider it a wash sale and I won’t be able to deduct the loss.  (It has been a 30 day wait in the past, but check this out carefully as the rules may have change and it could cost you thousands of dollars if you are wrong.)  The sale of 100 shares of Home Depot would generate about a $8500 gain.  The sale of the 550 shares of Greenbrier would create about a $12,000 loss, so I could deduct the gain from the sale of Home Depot and still have a deduction that I could use to offset regular income from work and/or carry forward into future years.

The danger here, besides doing it wrong and losing the ability to use the loss, is that I’ll be taking up a bigger position in Greenbrier for the months in which I hold the extra shares.  Because the shares have already declined so far the risk of a big decline in that period is somewhat reduced (shares are certainly cheap compared to where they have been, and surely someone will step in soon and start buying again), but things could decline further.  Also, there could be something that happens at the company like a scandal or a big lawsuit that could cause the shares to drop dramatically.  While this is rare, it happens from time to time with individual stocks. Sometimes the price will never recover after such an event occurs, so you need to be sure to put more money into a company than you can afford to lose.

If done correctly, you can use losses to reduce the gains you have while still maintaining positions in companies that you think will recover and grow.  You need to be careful to avoid wash sales, and you need to be careful not to hold too big a position due to the risk that creates, but done right is can save you a lot of money on taxes.

Hey, I sure don’t know it all.  Help make this site better by leaving a comment!

Got and investing question? Please send it to or leave in a comment.   

Follow on Twitter to get news about new articles. @SmallIvy_SI

Disclaimer: This blog is not meant to give financial planning or tax advice. It gives general information on investment strategy, picking stocks, and generally managing money to build wealth. It is not a solicitation to buy or sell stocks or any security. Financial planning advice should be sought from a certified financial planner, which the author is not. Tax advice should be sought from a CPA. All investments involve risk and the reader as urged to consider risks carefully and seek the advice of experts if needed before investing.


  1. This is a great post. One of the stocks I worry about is Apple. I have made a significant amount of money, but I am concerned that they are a bit overvalued.

    • Actually I was reading an article that showed that the value of Apple is equal to about 3/4ths of the value of all US small stocks – crazy. They are definitely huge. I hate taking gains because of taxes, but then again, a move down in the price of a stock can cost a lot really quickly. Maybe you can lessen the pain by offsetting against a losing position.

Comments appreciated! What are your thoughts? Questions?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.