By this metric, many dividends are now unsustainable

Investors love a good dividend, but companies have to earn the money before they can give it away.

That's a fact that seems to have been lost on almost 20 percent of the companies paying dividends in the S&P 500 that paid out more than they earned in the last fiscal year. That's up from around 9 percent a decade ago.

One way to judge the sustainability of cash dispersals is to look at a company's dividend payout ratio, as ClientFirst Strategy president Mitch Goldberg pointed out in recent commentary on CNBC.com. The ratio is simply the dividend per share divided by earnings per share, with a number above 1 (or 100 when expressed as a percentage) indicating that the company is paying out more than it's earning.

Generally, lower numbers mean the company has more space to maneuver before it would ever have to cut its dividend. A company with a 50 percent ratio could lose half of its earnings and still pay its dividend.

For all companies in the S&P 500, that ratio has been rising steadily over the last decade. Today, the median ratio is at a high of 37 percent, compared to 20 percent in 2006. That means that while half of all companies had ratios below 20 percent a decade ago, only about one in five do today, and more than twice as many are in the possibly unsustainable red zone above the break-even of 100 percent.

Explore the data by hovering over each company below and using the slider to look at different years:

2006

As shown in the time series above, the distribution has spread out over the last decade, and dividends have grown faster than earnings. That means that more of the companies that were once in the blue section are now in the purple or red sections.

Among companies with both positive earnings and data for each year, GE comes out with the worst dividend payout ratio in the last fiscal year — paying out about $6 for every dollar the company earned.

Even worse are the more than 30 companies that have continued paying out dividends while losing money for the year. The payout ratio breaks down as a good comparison metric when companies have negative earnings, but it's clear that the main offenders in this category are down-on-their-luck energy companies.

About 60 percent of the companies that paid out dividends despite negative earnings were in oil-related businesses. The story is different for the approximately 40 companies with positive earnings and ratios of 100 percent or higher — only three of those companies are oil-related. Also included are large pharmaceutical and consumer goods companies and a number of real estate investment trusts.

In his commentary, Goldberg said that he prefers companies to maintain a dividend payout ratio under 80 percent. Companies with ratios below 50 percent have plenty of room to increase their dividends going forward.

Looking at the ratios themselves for companies in the S&P 500 that paid dividends in 2006 compared to 2015, it's clear that the higher-risk categories have expanded. About 25 percent of dividend-paying companies are above Goldberg's 80 percent ratio threshold today, compared to 11 percent a decade ago.

While some companies may be able to withstand a ratio that is over 100 percent or negative by cutting into their balance sheets, over the long term companies with modest ratios are more likely to make good on their payout promises going forward.

The overall picture is one of a market that is under pressure to sustain large dividends but is more likely to be missing the fundamentals. If revenues continue to slump and earnings growth falls, companies could abandon their dividends, leaving investors who leaned too heavily on high-dividend companies in the lurch. Even if economic indicators stay exactly where they are today, companies will steadily draw back those payments, Goldberg said in an interview.

"It's not going to take that much for these companies to acknowledge that they can't keep up with their dividends," Goldberg said. "I think investors who gorged on dividend stocks are in for a deeper pullback then they may have seen in previous cycles."

Like high buybacks, high dividends may be a sign that companies may be prioritizing short-term gains over long-term research and development. If a recession is looming, those companies may come to regret those decisions, Goldberg said.

"The problem I have with financial engineering is that it's a sugar high that wears off way too quickly, and it doesn't in my opinion often leave companies better off over the long term," he said. "Companies that didn't reinvest over the last 10 years are going to pay the price."

Read More Why stock buybacks often end up disappointing

Read More Google's many investments have it sometimes fighting itself