Warren Buffett's favorite holding period is forever, as he often remarks, but it doesn't always work out that way. In reality, the Oracle of Omaha and his team sell stocks regularly, and for a variety of reasons. In fact, of the nine major stock positions in Berkshire Hathaway's (BRK.A 0.64%) (BRK.B 0.54%) portfolio 25 years ago, only three remain today.

However, there are right and wrong reasons to sell stocks, and Warren Buffett's past comments, as well as Berkshire's actions, can help guide you in the right direction.

Warren Buffett speaking to shareholders.

Image source: The Motley Fool.

How Warren Buffett decides it's time to sell

At Berkshire Hathaway's 2002 shareholder meeting, Buffett responded to a question about when he'll decide to sell a stock. At the time, Berkshire had recently sold McDonald's (MCD 0.38%) and Disney (DIS -0.45%) stock after holding them for uncharacteristically short time periods.

Buffett mentioned two main reasons he'll sell a stock. The first is when he feels Berkshire needs the money for a more attractive opportunity. "We would sell if we needed money for something else -- I would reluctantly sell something terribly cheap to buy something even cheaper," said Buffett. This doesn't happen to Berkshire too often these days -- after all, the company has more than $100 billion in cash. However, it does happen, and I'll discuss a specific, recent example in the next section.

The second, and more common, reason Buffett sells stocks is because of changing fundamentals, or a changing competitive landscape. As Buffett said:

We sell really when we think we're reevaluating the economic characteristics of the business. We probably had one view of the long-term competitive advantage of the company at the time we've bought it, and we may have modified that. That doesn't mean that we think the company is going into some disasterous period, or anything like that. We think McDonald's has a fine future, we think Disney has a fine future, and there are others. But we don't think their competitive advantage is as strong as we thought it was when we initially made the decision.

Real-world examples of stocks Buffett has sold

To illustrate some of these points, as well as some other reasons Buffett and the rest of Berkshire's team may be inclined to sell stocks, here are a few examples from the company's history:

  • IBM (IBM -0.89%): Berkshire had been gradually unloading its IBM stake for some time, and Buffett confirmed that the last of the shares were sold during the first quarter of 2018. In a nutshell, Buffett says he misjudged IBM's competitive challenges, and as a result, it has revalued the stock lower. This is a prime example of the concept of "when your original thesis no longer applies, get out."
  • Wells Fargo (WFC 2.73%): Berkshire has sold some of its Wells Fargo stock in recent quarters, and you might assume it has something to do with the bank's infamous "fake accounts" scandal. But you'd be wrong. Buffett has said several times that he intends to stick with Wells Fargo, but regulatory rules prevent him from owning more than 10% of the bank's shares. The recent sales were solely to remain under that threshold.
  • Freddie Mac (FMCC -5.38%): Many newer Berkshire investors are surprised to hear that Buffett was ever a fan of mortgage giant Freddie Mac, but Berkshire owned 9% of the company's shares in the late 1990s. Berkshire made lots of money on the investment, but Buffett started to see troubling signs -- specifically, the company was taking on far too much risk to keep its earnings growing at a double-digit rate. Buffett ended up selling all of Berkshire's Freddie Mac shares by 2000, and we all know what happened during the mortgage meltdown -- there's a reason Freddie Mac is a penny stock today.
  • ExxonMobil (XOM -0.09%): Until late 2014, Berkshire was one of ExxonMobil's largest shareholders. However, Buffett realized that oil prices weren't likely to stay as high as he originally thought, so Berkshire's entire stake was abruptly sold.
  • Goldman Sachs (GS -0.20%): Warren Buffett's preferred uses for Berkshire Hathaway's capital are to acquire entire businesses and buy common stocks -- in that order. So, when Buffett sold 13% of Berkshire's Goldman Sachs shares a few years ago, he cited his reason as raising capital for the pending Precision Castparts acquisition. This makes sense -- if you feel your capital can be deployed more effectively elsewhere, it can make perfect sense to sell.

Bad reasons to sell

To be thorough, there are some bad reasons to sell a stock that investors should avoid. These include, but aren't necessarily limited to:

  • Because the stock's price plunged: This is perhaps the worst possible reason to sell a stock. If your original reasons for buying still apply, and the price has gone down significantly, it should be looked at as an opportunity to buy, not to sell.
  • Because the stock's price increased sharply: I've been guilty of this one a few times, and at first, this might not sound like a bad reason to sell. For example, I sold Tesla after shares roughly tripled from its IPO price, even though all signs were pointing toward dramatically improved vehicle sales and a path to long-term profitability. In the years since, shares have increased another 300% or so from where I sold it.
  • Because a billionaire sold: This applies even if that billionaire is named Warren Buffett. Now, if a billionaire sells a stock, it could be a good time to do a little digging and find out why. However, I'm saying that you shouldn't sell just because a billionaire did. For example, I mentioned that Buffett sold some Goldman Sachs a couple years ago, but a little research would show that this was mainly to finance an acquisition rather than because of fears about the stock itself.

The bottom line: Selling stocks is fine -- if you do it for the right reasons. Sell because a company has fundamentally changed, or because you can deploy your money more effectively somewhere else. Don't sell just because everyone else is, or to lock in a quick profit.