We all invest for the same reason: to make money. And to make money in investing, we need to know two key things: when to buy and when to sell.

If you can buy something for $1 and turn around and sell it for $2, then you've made money. If, on the other hand, you buy something for a buck and can't find someone willing to take it off your hands for more than $0.50, you've lost money. Clearly, to make money at investing, the goal is to buy low and sell high. More than half a century ago, Benjamin Graham, the pioneer of value investing, came up with a simple way to do just that -- a concept known as the "margin of safety." By employing this technique, investors greatly decrease the chance that they'll lose their hats and increase the likelihood that they'll trounce other investors.

Following in Graham's footsteps, Bill Miller, who runs Legg Mason Value Trust (LMVTX), beat the market for 15 consecutive years -- something that's practically unheard of in the mutual fund industry. And Miller's long-run performance pales in comparison with that of Warren Buffett, a former pupil of Graham's. What's more, Graham's margin of safety is something we put to good use here at the Motley Fool Inside Value investing service.

Know a company's true worth
The key to success is a clear understanding of a company's true worth. With that knowledge in hand, buying low and selling high becomes a simple matter of waiting, buying a stock only when it falls below the company's true worth by a tempting margin. Once you own it, you need to keep tracking the company's value. When the stock rises to an uncomfortably high premium to its true worth, sell it. The central lesson: All buying and selling decisions should be guided by comparing a company's stock price to its true worth, not by some vague notion of what the hot stock of the moment is.

My friend and colleague Philip Durell follows that philosophy as the chief analyst at Inside Value. His selections as a whole are handily beating the market's return since the newsletter's inception in 2004. His record is added proof that using a margin of safety truly does work.

Philip has beaten the market without help from the likes of coal companies such as Arch Coal (NYSE:ACI). Its shares may have blown the market away over the past five years, but it owes its run more to changes in the price of energy than to any particular improvements in its operations.

Instead, Philip has relied on companies with competitive moats, such as management consulting giant Accenture (NYSE:ACN). Because of its large size, strong reputation, and solid track record, Accenture can command premium prices for its services. Additionally, since many other consulting firms are attached to technology giants like IBM (NYSE:IBM) or SAP (NYSE:SAP), Accenture's independence in that area makes it easier to maintain the objectivity that helps it win customers.

Philip first picked Accenture in June 2005, after a decline in its operating margins spooked Wall Street. He recognized that the decline was largely temporary, rather than the permanent reduction in value that the market panic had predicted.

Buying low with the margin of safety
Every company has what Graham calls an "intrinsic value," a measure of what that company is really worth. Finding that value is part art and part analysis. One of the most powerful tools in a value investor's toolkit is a discounted cash flow calculator, into which you put your estimate of how much cash the company will generate in the ensuing years. The calculator then tells you how much the company is worth today. Inside Value has just such a calculator available to subscribers. If you're already a subscriber, you have access any time. If not, you can get access by taking a free 30-day trial of the newsletter. Then you can play with the calculator to your heart's content.

Imagine buying fast-food titan McDonald's (NYSE:MCD) in March 2003. At the time, its shares traded below $12.50 a stub, thanks to the one-two punch of a struggling turnaround and fears of lawsuits tying the company to America's obesity epidemic. Now, thanks to an improvement in its operations and the legal environment, along with potential interest from real estate giant Vornado (NYSE:VNO) to help McDonald's unlock the value of its land, shares in the home of the Big Mac have rebounded to around $44. They've more than tripled in just a few years, and in so doing, they've returned to a much more rational level. It's a tremendously powerful example of what your money can do if you find and buy firms trading at bargain-basement prices.

Selling high with the margin of safety
Logically, if a company trading below its intrinsic value is worth buying, then a company trading at or above its intrinsic value just might be a candidate for selling. For instance, in October 2004, I profiled struggling life insurance company Presidential Life (NASDAQ:PLFE), pegging my estimate of the company's fair value at $17.88. The rising dividends I had been hoping to see to justify that valuation never materialized, yet the firm's shares rose anyway. They eventually reached an uncomfortably high valuation compared with their true worth. When they hit $25.12 last March, I sold, gladly pocketing an 80% total return in just over two years. Even better, I've been able to sleep at night, knowing my money was no longer tied up in a company whose market price I couldn't justify.

Follow the formula
Once you've figured out what a company is really worth, its margin of safety will tell you when it's time to buy and when it's time to sell. The lower a company's price with respect to that intrinsic value, the stronger the margin of safety, and the better the chance that buying that company will lead to a profitable investment. The higher a company's price with respect to intrinsic value, the more that margin of safety has been reversed, and the better the chance that it's time to sell your position and take the extra profits from your bargain-hunting trip.

Like the idea of knowing how to buy low and sell high? Want more value investing tips and techniques? Start with a free 30-day trial of Inside Value, The Motley Fool's home of the margin of safety.

This article was originally published on July 13, 2005. It has been updated.

At the time of publication, Fool contributor and Inside Value team member Chuck Saletta did not own shares in any company mentioned in this article. Accenture is an Inside Value selection. The Fool has a disclosure policy.