Infants who are given antacids like Zantac or Pepcid are more likely to develop childhood allergies, perhaps because these drugs may alter their gut bacteria, a new large study suggests.

Early use of antibiotics also raised the chances of allergies in the study of nearly 800,000 children.

Researchers combed the health records of kids born between 2001 and 2013 and covered by Tricare, an insurance program for active duty and retired military personnel and their families. A surprising 9 per cent of the babies received antacids, reflecting the popularity of treating reflux in infancy.

Over four years, more than half of all the children developed allergies to foods or medications, rashes, asthma, hay fever or other allergic diseases. The study couldn't prove causes, but the connection with antacids and antibiotics was striking.

For children who received an antacid during their first six months, the chances of developing a food allergy doubled; the chances of developing a severe allergic reaction called anaphylaxis or hay fever were about 50 per cent higher. For babies who received antibiotics, the chances doubled for asthma and were at least 50 per cent higher for hay fever and anaphylaxis.

The results were published Monday in JAMA Pediatrics.

"These medicines are considered generally harmless and something to try with fussy babies who spit up a lot," said lead researcher Dr. Edward Mitre of the Uniformed Services University in Bethesda, Maryland. "We should be a little more cautious prescribing these medicines."

Mitre's interest began when his youngest was a baby. A pediatrician suggested an antacid because the baby cried when on his back.

"We didn't give it to him. He did not have terrible reflux. He got fussy when you put him flat," Mitre recalled.

In the study, it's possible medications were given to infants who already had allergies and were misdiagnosed, the authors acknowledged. But that didn't seem likely to explain all of the strong effect they saw.

Gut bacteria play a role in a healthy immune system. Antibiotics and antacids might change the makeup of a baby's microbiome, perhaps enough to cause an overreaction in the immune system that shows up as an allergy, Mitre said. Antacids also change the way protein is digested and some may alter development of immune system pathways.

Study co-author and pediatrician Dr. Cade Nylund of Uniformed Services University said parents can try offering fussy babies smaller amounts of food more often and frequent burping during meals.