Chipotle Mexican Grill (CMG 0.17%) continues its impressive performance. The stock is up 48% in 2023 and 371% over the past five years, absolutely crushing the broader market by an insanely wide margin. This type of gain isn't coming from a high-flying software business, but a brick-and-mortar restaurant chain. 

I've been amazed at Chipotle's execution for quite some time, especially as it navigated the pandemic and is still finding ways to grow and expand margins during elevated inflation and in an uncertain economy. But my portfolio hasn't benefited from the share price's rapid rise because I was caught up on a key metric that prevented me from buying the stock. 

Here's what I got wrong about Chipotle. Hopefully, you can learn from my experience to improve your own investing process. 

Family eating Tex Mex food.

Image source: Getty Images.

Where's the margin of safety? 

Almost three years ago, in July 2020, I first discussed Chipotle's investment merits. Namely, I focused on why Warren Buffett would love the business because of its strong brand, customer value proposition, and pricing power. All these things still hold true today, and this company is firing on all cylinders. 

But I said at the time that the valuation was way too expensive. Back then, Chipotle's stock was trading at a blistering price-to-earnings (P/E) ratio of 95. That type of premium is a huge ask for any investor, in my opinion. That's because there was no margin of safety, meaning that Chipotle's valuation indicated that nothing could go wrong with the company going forward, and investors had no downside protection should their bullishness on the stock not play out as planned. 

For someone who doesn't prioritize the valuation being paid, maybe it would've made sense to buy the stock. Since that point, the shares are up about 80%, an excellent return in less than three years' time. But also, since that point, the P/E ratio has averaged 84. 

Boosting sales and profits 

I think it would be very difficult for any investor who takes a closer look at Chipotle to find something they don't like about the business. And this makes it a worthy investment candidate. 

Over the past several years, the company has posted strong revenue and same-store sales growth with improving profitability. Management continues opening new stores, mostly equipped with drive-thrus, and average sales per location keep rising.

Chipotle's digital push, exemplified by 33 million Rewards members, gives it a leg up on rivals. And its menu price hikes aren't driving customers away.

Even more impressive is that fact that the company was virtually unaffected by the coronavirus pandemic, supply chain bottlenecks, inflationary pressures, and the current uncertain economic backdrop. Having dealt with all those unpredictable events has likely made the management team and business itself that much stronger and well positioned to thrive in the future.  

Investors should be mindful 

Looking back on my experience with Chipotle, the biggest takeaway for investors is that seemingly overvalued stocks can still produce good returns. That's because even though shares might be priced for perfection, the company can still deliver financial results that exceed Wall Street expectations. This is something that Chipotle continues to do, and that's why the stock keeps outperforming. 

However, investors must understand what their expectations are before buying a stake in a company. If the hope is that the business will continue beating expectations even though its valuation is already very high, then there's really no margin of safety or room for error. If the company misses revenue or earnings estimates, shares could tank rapidly. So it's always a good idea to figure these things out before buying 

At a P/E ratio of nearly 56 right now, I still believe that Chipotle's stock is overvalued. And I could still be wrong.