ATLANTA — Coca-Cola keeps the recipe for its 127-year-old soda inside an imposing steel vault that’s bathed in red security lights. Several cameras monitor the area to make sure the fizzy formula stays a secret.

But in one of the many signs that the surveillance is as much about theater as reality, the images that pop up on video screens are of smiling tourists waving at themselves.

“It’s a little bit for show,” concedes a guard at the World of Coca-Cola museum in downtown Atlanta, where the vault is revealed at the end of an exhibit in a puff of smoke.

The ability to push a quaint narrative about a product’s origins and fuel a sense of nostalgia can help drive billions of dollars in sales. That’s invaluable at a time when food makers face greater competition from smaller players and cheaper supermarket store brands that appeal to cash-strapped Americans.

It’s why companies such as Coca-Cola and Twinkies owner Hostess Brands play up the notion that their recipes are sacred, unchanging documents that need to be closely guarded. As it turns out, some recipes have changed over time, while others may not have. Either way, they all stick to the same script that their formulas have remained the same.

John Ruff, who formerly headed research and development at Kraft Foods, said companies often recalibrate ingredients for various reasons, including new regulations, fluctuations in commodity costs and other issues that affect mass food production.

“It’s almost this mythological thing, the secret formula,” said the president of the Institute of Food Technologists, which studies the science of food. “I would be amazed if formulas (for big brands) haven’t changed.”

This summer, the Twinkies cream-filled cakes that many Americans grew up snacking on made a comeback after being off shelves for about nine months following the bankruptcy of Hostess. At the time, the new owners promised the spongy yellow cakes would taste just like people remember.

A representative for Hostess, Hannah Arnold, said in an email that Twinkies today are “remarkably close to the original recipe,” noting that the first three ingredients are still enriched flour, water and sugar.

Yet a box of Twinkies now lists more than 25 ingredients and has a shelf-life of 45 days, almost three weeks longer than the 26 days from just a year ago. That suggests the ingredients have been tinkered with, to say the least, since they were created in 1930.

“When Twinkies first came out they were largely made from fresh ingredients,” notes Steve Ettlinger, author of “Twinkie, Deconstructed,” which traces the roots of the cake’s many modern-day industrial ingredients.

For its part, KFC says it still strictly follows the recipe created in 1940 by its famously bearded founder, Colonel Harland Sanders. The chain understood the power of marketing early on, with Sanders originally dying his beard white to achieve a more grandfatherly look.

Fast forward to 2009, when KFC decided the security for the handwritten copy of the recipe needed a flashy upgrade. It installed a 770-pound safe that is under constant video and motion-detection surveillance and is surrounded by 2 feet of concrete on every side — just in case any would-be thieves try to dig a tunnel to get it.

“Like something out of a Hollywood movie,” a news release from KFC trumpeted at the time.

Coca-Cola and PepsiCo, the nation’s No. 1 and 2 soda makers, respectively, also are known for touting the roots of their recipes.

In the book “Secret Formula,” which was published in 1994 and drew from interviews with former executives and access to Coca-Cola’s corporate archives, reporter Frederick Allen noted that multiple changes were made to the formula over the years. For instance, Allen noted that the soda once contained trace amounts of cocaine as a result of the coca leaves in the ingredients, as well as four times the amount of caffeine.

In an emailed statement, Coca-Cola said its secret formula has remained the same since it was invented in 1886 and that cocaine has “never been an added ingredient” in its soda.

PepsiCo also celebrates its origins. In the past two years it held its annual shareholders meeting in New Bern, N.C., where Caleb Bradham is said to have created the company’s flagship soda in the late 1890s. But the formula for Pepsi was changed to make it sweeter in 1931 by the company’s new owner, who didn’t like the taste.

In the 1980s, Coca-Cola and PepsiCo both switched from sugar to high-fructose corn syrup, a cheaper sweetener. Last year, the companies also said they had changed the way they make the caramel coloring used in their sodas to avoid having to put a cancer warning label on their drinks in California, where a new law required such labels for foods containing a certain level of carcinogens.

Both Coca-Cola and PepsiCo say the sweetener and caramel sources do not alter the basic formulas or taste for their sodas. And they continue to hype the enduring quality of their recipes.

This past spring, for example, Coca-Cola welcomed the widespread news coverage of a Georgia man who claimed to have found a copy of the soda’s formula and tried to sell it on eBay. The company saw the fanfare as evidence of the public’s fascination with its formula, and eagerly offered to make its corporate historian available for interviews to fuel the media attention.

Likewise, the company is happy to reminisce about the backlash provoked by the introduction of New Coke in 1985. The sweeter formula was marketed as an improved replacement for the flagship soda, and the company points to the outrage that ensued as proof of how much people love the original. According to the emailed statement from Coca-Cola, that’s the only time the company ever tried changing its formula.

The loyalty to that narrative is on full display at the World of Coca-Cola, where visitors mill about in a darkened exhibit devoted to myths surrounding the soda’s formula. Tabloid-style headlines are splashed across the walls, and whispers play on a recorded loop:

“Even if you could see the formula, you wouldn’t understand it!” a voice says. “It’s the greatest mystery of all time!” says another.

The museum gets about a million visitors a year, with a plaque at the end of one exhibit stating “Keeping the Secret Ensures That the Magic Lives On.” But on a recent summer afternoon, at least one of them wasn’t impressed.

“This part’s boring,” a small boy declared.