By Kevin Kelleher, contributor
FORTUNE – The carefree days of Yahoo -- when the web pioneer's name was more of an exuberant cry rather than a sarcastic remark -- are behind it. For several years, the company has struggled to right itself in the face of tough competition from Google and Facebook. If Yahoo was going to return to the forefront of web innovation, it probably would have happened by now.
What are its options? Here they are, in a not-so-pleasant nutshell. Yahoo (yhoo) can remain an independent public company, staying on its agonizing path of turning itself around. It can sell part or all of itself to private equity firms. Or it can merge with other firms in similar straits, hoping that economies of scale fix things.
None of these options is very appealing. But one of them is significantly less unappealing than the others: If Yahoo were to merge with Microsoft (msft) and AOL (aol), two companies it recently forged an online-ad alliance with, Yahoo has a decent shot at a steadily profitable if not exactly glamorous future -- one that could still satisfy both users and shareholders.
Such a tie-up could be the least bad of the three options. The first two options are likely to lead to unhappy outcomes for Yahoo. Yahoo has tried to turn itself around for years, with results that could be described at best as treading water. Over the past five years, revenue has declined steadily while net income has flatlined. The stock itself has vacillated around the $15 mark for the last three years. A lot of the value is tied up in Asian assets that few Americans know anything about.
So although Yahoo would prefer to remain an independent public company, it would mean battling increasingly disenchanted shareholders in the face of ever-tougher competition. Google (goog) is gaining ground in display ads, leaving Yahoo a smaller piece of the pie it once dominated. Meanwhile, social media ads -- a perennial weak spot for Yahoo -- is eating up a bigger piece of total online-ad spending.
So Yahoo is likely to be bought out, either by private equity firms or another tech company. Most reports point to private equity firms as the more likely buyers. KKR (kkr), Blackstone (bx), Silver Lake and others are reportedly kicking Yahoo's tires with an eye to buying part or all of the company.
Although this seems like the most likely scenario for Yahoo right now, it wouldn't be easy. Yahoo's $19.5 billion market cap is large by the standards of most leveraged-buyout candidates. Its structure is complicated by its relationships with Yahoo Japan and Alibaba. A private bid could incite hostile buyers into action. If the private bidders try to buy Yahoo with a PIPE, a controversial move usually reserved for the most desperate companies, it could dilute current shareholders.
And for Yahoo's employees and users, a sale to private equity could become the worst option. Many private firms see a turnaround as a short-term accomplishment. They would almost certainly sell off the Asian assets and slash all but the most central operations of the core business. The buyers would sell a few years later at a profit, the remaining Yahoo would be much leaner.
That leaves a merger with one or more companies that, like Yahoo, are also-rans on the web. Online advertising is still a thriving business, but every few years a giant like Google or Facebook comes along and plants itself at the center of the Internet, drawing in a larger share of advertising spending and growing like crazy. That leaves everyone else fighting for a share of the periphery. That's where Yahoo has been toiling for years -- on the peripheral web.
The giants at the center of the web thrive through innovation, finding new and more efficient ways to engage users. Those on the peripheral competethrough an ability to manage a vast inventory of content that can be managed profitably. Despite Yahoo's recent turmoil, its net profit margin has remained around 20% for the past several quarters.
Yahoo's third option -- and at this point, its best -- would be to combine forces with other companies mining the soil on the peripheral web. It's an area where economies of scale could fatten profit margins. Last week, Yahoo joined with Microsoft and AOL to form a partnership to sell each others' “Class 2” (that is, not-so-desirable) display ads on each others' sites. It could be simply a defensive move, but some thought it could be a trial balloon for something more intimate.
Merging Yahoo, AOL and Microsoft's online operations would draw the inevitable comparisons to tying three bricks together. But beyond simple economies of scale, such a deal would offer strengths to complement the others' weaknesses. Yahoo has long and deep relationships with the biggest advertisers on the web and a core business that is profitable. AOL has built out an empire of second-tier content that Yahoo's sales force is already selling ads on. And Microsoft has an efficient search engine as well as the overseas presence and cash on hand to strengthen Yahoo's presence in Asia.
A combined Microsoft-Yahoo-AOL would still have a hard time fighting its way back to the innovative center of the web. But it could integrate the three companies into a single one that would have a much better chance of reaching a broad base of users and running a healthy online business.
So such a merger wouldn't return any of these companies to its glory days. But it's better than the alternative: Microsoft and AOL continuing to lose and Yahoo carved up into pieces.