THEY make some of the world’s best-loved products. Their logos are instantly recognisable, their advertising jingles seared in shoppers’ brains. For investors, they promise steady returns in turbulent times. They seem to be getting ever bigger: on June 30th Mondelez International made a $23 billion bid for Hershey to create the world’s biggest confectioner; and on July 7th Danone, the world’s largest yogurt maker, agreed to buy WhiteWave Foods, a natural-food group, for $12.5 billion. Yet trouble lurks for the giants in consumer packaged goods (CPG), which also include firms such as General Mills, Nestlé, Procter & Gamble and Unilever. As one executive admits in a moment of candour, “We’re kind of fucked.”

For a hint of the problem they face, take the example of Daniel Lubetzky, who began peddling his fruit-and-nut bars in health-food stores: his KIND bars are now ubiquitous, stacked in airports and Walmarts. Or that of Michael Dubin and Mark Levine, entrepreneurs irked by expensive razors, who began shipping cheaper ones directly to consumers five years ago. Their Dollar Shave Club now controls 5% of America’s razor market.

Such stories abound. From 2011 to 2015 large CPG companies lost nearly three percentage points of market share in America, according to a joint study by the Boston Consulting Group and IRI, a consultancy and data provider, respectively. In emerging markets local competitors are a growing headache for multinational giants. Nestlé, the world’s biggest food company, has missed its target of 5-6% sales growth for three years running.

For a time, size gave CPG companies a staggering advantage. Centralising decisions and consolidating manufacturing helped firms expand margins. Deep pockets meant companies could spend millions on a flashy television advertisement, then see sales rise. Firms distributed goods to a vast network of stores, paying for prominent placement on shelves.

Yet these advantages are not what they once were. Consolidating factories has made companies more vulnerable to the swing of a particular currency, points out Nik Modi of RBC Capital Markets, a bank. The impact of television adverts is fading, as consumers learn about products on social media and from online reviews. At the same time, barriers to entry are falling for small firms. They can outsource production and advertise online. Distribution is getting easier, too: a young brand may prove itself with online sales, then move into big stores. Financing mirrors the same trend: last year investors poured $3.3 billion into private CPG firms, according to CB Insights, a data firm—up by 58% from 2014 and a whopping 638% since 2011.

Most troublesome, the lumbering giants are finding it hard to keep up with fast-changing consumer markets. Ali Dibadj of Sanford C. Bernstein, a research firm, points out that some consumers in middle-income countries began by assuming Western products were superior. As their economies grew, local players often proved more attuned to shoppers’ needs. Since 2004 big emerging economies have seen a surge of local and regional companies, according to data compiled by RBC. In China, for example, Yunnan Baiyao Group accounts for 10% of the toothpaste market, with sales growing by 45% each year since 2004. In Brazil Botica Comercial Farmacêutica sells nearly 30% of perfume. And in India Ghari Industries now peddles more than 17% of detergent.

In America and Europe, the world’s biggest consumer markets, many firms have been similarly leaden-footed. If a shopper wants a basic product, he can choose from cheap, store-brand goods from the likes of Aldi and Walmart. But if a customer wants to pay more for a product, it may not be for a traditional big brand. This may be because shoppers trust little brands more than established ones. One-third of American consumers surveyed by Deloitte, a consultancy, said they would pay at least 10% more for the “craft” version of a good, a greater share than would pay extra for convenience or innovation. Interest in organic products has been a particular challenge for big manufacturers whose packages list such tasty-sounding ingredients as sodium benzoate and Yellow 6.

All this has provided a big opening for smaller firms. In recent years they contributed to a proliferation of new products (see chart). For instance, America now boasts more than 4,000 craft brewers, up by 200% in the past decade. For a sign of the times, look no further than Wilde, which sells snack bars made of baked meat. The bars, revolting to some, may appeal to the herd of weekend triathletes who want to eat like cave men.

Big companies have been trying to respond. One answer is to focus more. In 2014 Procter & Gamble said it would sell off or consolidate about 100 brands, to devote itself to top products such as Gillette razors and Tide detergent. Mondelez, the seller of Oreo biscuits and Cadbury’s chocolate, is spending more to understand who snacks on what, and why. But the most notable strategy has been to buy other firms and cut costs. 3G, a Brazilian private-equity firm, looms over the industry. It has slashed budgets at Heinz, a 147-year-old company it bought in 2013; then Kraft, which it merged with Heinz in 2015; as well as Anheuser-Busch InBev, a beer behemoth poised to swallow SABMiller. Heinz’s profit margin widened from 18% to 28% in just two years, according to Sanford C. Bernstein. Big firms are also acquiring or backing smaller rivals. In 2013 two American food companies and a French one—Campbell Soup, Hain Celestial and Danone—each snapped up a maker of organic baby food. Coca-Cola and Unilever, an Anglo-Dutch titan, have long bought companies outright or invested in them. Both General Mills and Campbell have launched their own venture-capital arms. Such strategies may eventually make CPG firms even more like big pharmaceutical companies. They may invent few products themselves and instead either acquire small firms or join up with them, then handle marketing, distribution and regulation. That has worked decently well for drugmakers. Yet consumers are more fickle when buying skin cream than a patent-protected cancer drug. A CPG firm may pay a bundle to buy a startup, only to see its products prove a fad. And cutting costs expands margins, but may depress sales.

Despite such conundrums, executives remain bullish. Tim Cofer, Mondelez’s chief growth officer, maintains that wise cuts and reinvestment will position the firm well. “This is about the scale of a $30 billion global snacking powerhouse,” he declares, “and at the same time the speed, the agility, the dexterity” of a startup.

Others are gloomier. EY, a consultancy, recently surveyed CPG executives. Eight in ten doubted their company could adapt to customer demand. Kristina Rogers of EY posits that firms may need to rethink their business, not just trim costs and sign deals. “Is the billion-dollar brand,” she wonders, “still a robust model?”