When I was younger, I thought millionaires were just lucky people born into a better life. But then I learned a statistic that dramatically shifted how I thought about money: 88% of all millionaires are self-made. 

While there are certainly many roads to becoming a millionaire, there's one thing nearly all have in common: they put their money to work in investments. As a stock investor, the key to a million dollar portfolio is actually quite simple. Here it is expressed as a formula:

Buy great companies + try to never sell them

Obviously the formula above is over-simplified, but it is the basic strategy that many of today's millionaire's have followed. 

Let's unpack it a bit more.

Wooden blocks showing upward trajectory

Image source: Getty Images

Invest early

Millionaires understand the power of time when it comes to investing. The best time to start investing is when you're young, and the next best time to start is right now.

The more time you give your investments to grow, the less risk you assume in your portfolio, and the greater your returns will be. 

Perhaps the best way to understand this concept is to experiment with a compound interest calculator

While people tend to think about money linearly, investments grow exponentially due to the fact that the interest begins to compound on itself over time. 

For example, a $1,000 investment that grows 10% annually will increase by $100 the first year, but then $110 the second year because it grows 10% of $1,100 instead of $1,000. Project this out over 20 years and you will notice the growth turns parabolic over time. 

When you start to play around with compounding, you'll notice that the gains toward the end of your holding period accelerate more rapidly. The last 5 years of a 20-year investment will be nearly equal to the growth of the first 15 years (assuming a constant monthly contribution and annual rate of return). 

Invest often

The example scenario above is a bit idealistic. After all, in the short term, we know the stock market is anything but constant. 

This is why investing often, sometimes called dollar-cost averaging, is so important. By contributing to your portfolio regularly, you are mitigating the risk of investing large sums of money right before a market collapse. History shows us that market crashes are a given, but instead of trying to predict when they will happen (which even the smartest economists usually fail to do), it's wiser to just invest your money every month. 

Investing regularly ensures your capital is put to work right away instead of sitting on the sidelines. It also gives you the peace of mind that comes with largely ignoring near-term market volatility. 

If you zoom out on the Vanguard 500 Index Fund ETF (VOO -0.41%), you will see a pretty consistent trend from the lower left of the chart to the upper right.

By investing a set amount every month, you're focusing on the long term trend of the market which historically has been very rewarding for investors. 

Sell rarely 

In his book One Up On Wall Street, investment manager Peter Lynch wrote:

"Selling your winners and holding your losers is like cutting the flowers and watering the weeds."

We often think buying bad companies is the worst mistake an investor can make, but if you consider the opportunity cost of off-loading a huge winner early, selling is actually a costlier error.

Stocks can only go down a maximum of 100% but great companies can appreciate, in theory, an infinite amount. If you're going to sell, make sure it's for a good reason, because it could cost you. 

Some examples of reasons to sell are: your investing thesis has been disproven, you need the money for something (like buying a house), or you believe you can get a higher rate of return elsewhere. 

But before you sell, remember winners tend to keep winning. 

Identifying great companies

Going back to our formula for investing success, you may be wondering how to find great companies

Many investors seem to think this entails uncovering obscure penny stocks before they blow up. But in reality, it's much easier than that. Great companies tend to keep being great over long periods of time, which means there are plenty of no-brainers to choose from. 

Consider some examples of very much on-the-radar businesses that have produced incredible returns: 

  • Chipotle Mexican Grill (CMG 6.33%) has returned over 3,500% since 2006. 
  • Lowe's (LOW -0.14%) has returned 1,100% since 2009. 
  • Domino's Pizza (DPZ 1.45%) has returned a whopping 7,700% since 2008. 

All of these companies have something in common: they were widely known consumer brands, even before their stocks took off. 

Identifying great companies obviously involves more than just buying the stock of your favorite restaurant or product – you still need to do your homework on the company. But as the examples above demonstrate, you don't need to be a genius stock picker to invest in winners. You just need to be willing to hold them long enough to reap the rewards. 

Great companies are all around us. Holding them is the hard part. But if you can regularly invest in a basket of high quality companies that you are highly convicted in... and hold them for years or better yet, decades, you are on the path toward becoming a millionaire.