There are right and wrong times to sell stocks. It's generally a bad idea to sell a stock simply because the price went up or down. On the other hand, there are some other situations that can be perfectly valid reasons to hit the sell button:

  1. The reasons you bought the stock no longer apply.
  2. The company is being acquired.
  3. You need the money or you soon will.
  4. You need to rebalance your portfolio (because it's out of balance or your investment goals change).
  5. You see a better opportunity to invest elsewhere.

With that in mind, here's a rundown of these five good reasons for when to sell stocks and how to know if one of them applies to you.

Green button labeled Sell on a keyboard

Image source: Getty Images.

1. The reasons you bought the stock no longer apply

I often get asked questions such as, "My Apple (NASDAQ:AAPL) stock has doubled since I bought it. Should I sell my stock now?"

My response is always the same: "Why did you buy the stock in the first place, and do those reasons still apply?" In simple terms, every stock investment you make should have a reason behind it other than just because you want the price to go up. This is known as an investment thesis.

As long as your investment thesis still applies (and none of the other reasons we're about to discuss apply), there's really no good reason to sell.

On the other hand, if something fundamental changes, it can be a good reason for selling stock. For example, this could mean:

  • The company's market share is falling or a competitor is now offering a superior product for a lower price.
  • Sales growth has noticeably slowed. 
  • The company's management has changed -- especially if the new managers are making reckless decisions like taking on too much debt.

Of course, this isn't an exhaustive list. Essentially, if something changes that contradicts your investment thesis, that's one of the best reasons to sell.

2. The company is being acquired

Another potentially good reason to sell is if one of the companies you invest in has agreed to be acquired. When an acquisition is announced, the stock price of the company being acquired typically rises to a level that is close to the agreed-upon price. In most instances, it's wise to lock in your gains in a case like this since your upside potential can be quite limited.

There are three possible ways a company can be acquired -- cash, stock, or a combination of the two.

In an all-cash acquisition, the stock typically gravitates toward the acquisition price. But if the deal falls apart, shares could come crashing down. In all-cash acquisitions, it's rarely worth holding on to your shares.

In stock or cash-and-stock deals, it can be a little trickier, and your decision comes down to whether you have any desire to be a shareholder in the acquiring company. For example, Slack Technologies (NYSE:WORK) recently agreed to be acquired by Salesforce (NYSE:CRM) in a cash-and-stock deal. Slack shareholders needed to decide whether they wanted to become Salesforce investors. If the answer in situations like this is no, it's perfectly acceptable to cash out. 

3. You need the money, or you soon will

It's generally a good rule of thumb to keep any money you'll need within the next few years away from the stock market. So if you need the money, that's certainly a good reason to sell. 

As an example, a friend of mine recently purchased a house and sold most of his favorite stock position to cover the down payment. 

Another example is if you plan on using your investment portfolio to send your kids to college. While they're young, it's completely fine to invest that money in the stock market, but once they're a few years away from going to college, it's wise to move that money into cash or equivalent investments such as CDs.


4. You need to rebalance your portfolio

Rebalancing your portfolio is another good reason you might want to sell a stock (or several). There are two main situations where this might be necessary:

  • High-performing stocks: I invested about 10% of my portfolio's value in Bank of America (NYSE:BAC) stock a few years ago. The shares nearly tripled over the next couple of years and ended up accounting for more than 20% of my portfolio's value at one point. Although this was a good problem to have, I simply wasn't comfortable having so much of my money invested in a single company.
  • Reducing stock exposure: As you get closer to retirement, it's smart to gradually reduce your exposure to stocks. One popular rule of thumb is to subtract your age from 110 to determine the percentage of your portfolio that should be invested in stocks. If it's been a few years since you've adjusted your asset allocation, you may want to consider selling some of your stock holdings to move the money into fixed-income investments (bonds).

5. You see a better opportunity to invest elsewhere

In a perfect world, you'd always have spare cash to invest every time you identify an attractive investment opportunity. However, that's likely not the case.

Here's a real-world example. When I put 10% of my money into Bank of America stock, I didn't just happen to have 10% of my portfolio sitting in cash. However, thanks to a short-term panic, some bank stocks were trading for ridiculously low valuations, and I knew this wasn't going to last. So I sold some shares of a broad-market exchange-traded fund (ETF) that I owned. There was nothing wrong with the ETF, but I saw an excellent long-term opportunity that was more compelling to me.

We sell stocks regularly, too

It's worth mentioning that while we at The Motley Fool always approach investments from a long-term perspective, that doesn't necessarily mean that we only suggest stocks to buy. Quite the opposite actually. We regularly send "sell" recommendations to our members and for some of the reasons mentioned here -- sometimes the reason we recommended it in the first place no longer applies, sometimes companies we recommend get acquired, and sometimes we simply feel that there are better opportunities elsewhere.

When not to sell a stock

Take note: None of the reasons I mention have anything to do with the share price of the stock itself or how much it gained or lost since you bought it.

In fact, making investment decisions based solely on price changes can be dangerous. Too many investors decide to sell simply because their stocks go up, only to realize too late that they went up for a reason and still had tremendous growth potential. And, it's a common mistake to sell simply because stocks go down "before things get any worse."

It's also a bad idea to sell stocks just to lower your taxes. There's a popular tax strategy known as tax loss harvesting, which essentially involves selling losing stock positions in order to reduce your taxable capital gains on other investments. To be clear, this can be a smart strategy, but only if the stock you sell is one that you already wanted to sell for other (valid) reasons.

The bottom line is that there are some very good reasons to sell stocks; many long-term-focused investors sell stocks frequently. Just be sure that you're selling for the right reasons and not simply to lock in a profit, prevent further declines, or save money on taxes. If you do that, you're not investing, you're trading, and there's a big difference between those two concepts.