This article was updated on April 6, 2017, and originally published on Sept. 6, 2015.

Investing in stocks involves buying and selling them. Investing successfully in stocks involves buying them when they present a compelling value, and then selling them when it makes sense to do so. It's common to be pretty thoughtful when deciding when to buy various stocks, but many people give much less thought to when to sell stocks -- with costly consequences.

There are many good and bad reasons you might sell a stock. Let's review a bunch of them.

bright red button labeled "sell"

Image source: Getty Images.

Bad reasons to sell stocks

A classic reason many people sell a stock is because it just plunged in value. This is very often the wrong thing to do. When a stock plunges, assess the reason why. Is it in some trouble? If so, is its trouble temporary or permanent? Permanent troubles are bad, but fleeting ones are often worth waiting out. Did the stock plunge as part of an overall market crash? If so, it will likely recover eventually. Selling in a panic is counter to what superinvestor Warren Buffett has advised: "Be fearful when others are greedy, and greedy when others are fearful."

Think twice, too, if you're planning to sell just because you realized a gain. If a stock has surged 20%, you could sell and collect a nice profit, but if the company seems to have many years of growth ahead, you might want to hang on to earn even more over the long run. Or split the difference and sell some shares, locking in some gain, while leaving the other shares to grow.

man in silhouette with arms outstretched, weighing the words "buy" and "sell" and standing in front of a big, projected dollar bill

The best investors buy and sell for good reasons, not silly ones. Image source: Pixabay.

Good reasons to sell stocks

There are still lots of excellent reasons to sell stocks, though. For example:

Sell if you'll need that money within a few years. You may have funds tied up in a terrific stock, but if you're planning to cash out next year in order to put a down payment on a home or pay for college, you're playing with fire. The stock market tends to rise over long periods, but anything can happen over short periods. And even wonderful businesses see their stocks swoon now and then. Keep short-term money (which you'll need within five or 10 years) in more stable investments, such as CDs or money market accounts.

Sell if the stock seems significantly overvalued. Such a stock may be more likely to fall in the near future than to rise. If you sell it, you can move the proceeds into a significantly undervalued stock, which is more likely to appreciate. This isn't a hard and fast rule, though, because it can also be effective to hang on for many years, through ups and downs, if you believe a company has strong long-term growth potential.

Sell if you don't really understand the company. You need to have a good understanding of what a company does and exactly how it makes its money. For example, you might think of the company Qualcomm as a semiconductor maker, but while it gets most of its revenue from its chips, it gets most of its income from licensing its technology -- collecting a royalty on almost every smartphone sold. If you don't understand the business model of your holdings, it will be hard to follow them and have a good handle on their competitive strengths and growth potential.

Sell if you don't really know why you own the stock. Maybe you bought a stock based on some breathlessly optimistic article, or on someone's recommendation. If you can't explain in a few minutes why you bought and own it, and what you expect from the holding, you probably shouldn't own it.

Sell if the reason you bought the stock has changed. Companies change direction now and then, or their fortunes change. If you loved a company's fat profit margins, but they have been falling because of increased competition, rethink whether you still want to own it.

Sell if you can't find good information on the company. This is especially true for penny stocks, which trade for less than about $5 per share and are notoriously risky. If the company's website doesn't include an investor information nook with links to audited financial statements, that's a red flag. If it's not clear how it's making money -- or if it's making money -- sell.

Sell if the company doesn't interest you. You could hold on and do well, but if you're bored by the company and unlikely to keep up with it and read its financial reports, then you're probably not going to notice if its fortunes change or if red flags pop up.

Sell if the company's financial measures are deteriorating. Are the growth rates for revenue and earnings slowing? Is the cash pile shrinking while debt is growing? Are profit margins trending down? These are all red flags worth some investigation.

Sell if you have too much of your money in a stock. One holding might do so well for you that it grows from representing 10% of your portfolio to making up 55% of it. If so, you've got too many eggs in that one basket, and it's probably best to pare down that position.

Sell if you have a better place to move that money. You might be content with a holding, seeing solid upside in it, but if you run across another company in which you have much more faith and higher expectations, it can be smart to sell the holding and buy into the new company. After all, the best investors keep their money focused on their best ideas, not just adding more and more holdings over the years. (That said, though, keep tax effects in mind, too. If you're selling Company A because you see a little more potential in Company B, but you'll be paying steep capital gains taxes on your Company A gain, selling might not be the best move.)

There are plenty of good reasons to sell a stock, so be sure you sell for a good one and not a bad one. Learning when it's best to sell stocks can help you reduce your losses.

Selena Maranjian owns shares of Qualcomm. The Motley Fool owns shares of and recommends Qualcomm. The Motley Fool has a disclosure policy.