Certain cookie dough ingredients have been linked with foodborne illness outbreaks, according to Soohyoun Ahn, PhD, a lecturer in the department of food science and human nutrition at the University of Florida in Gainesville. “All health agencies and food regulating agencies strictly advise against eating raw cookie dough, and if you are making cookies with children, you have to be extra careful, because their immunity is not as strong as that of adults,” she says. The Centers for Disease Control and Prevention (CDC) estimates that 48 million Americans get food poisoning every year, and 128,000 are hospitalized.

The ingredient in cookie dough that most people know to be potentially harmful is raw egg. Chickens and other live poultry can carry a genus of bacteria called Salmonella, which can contaminate their eggs. Salmonella can cause mild to severe gastrointestinal illness called gastroenteritis, which is commonly known as stomach flu. Symptoms typically begin sometime between six hours and six days after exposure to the bacteria, including diarrhea, fever, and stomach cramps. While most people recover on their own without treatment, food poisoning can be dangerous for children younger than 5 years, adults 65 years and older, and individuals with a weakened immune system or those who take immunosuppressant medications that prevent their body from fighting off infection, the CDC reports. “The rate of salmonella poisoning with eggs is low, but don’t take that for granted,” says Beth Czerwony, RD, a registered dietitian at Cleveland Clinic. You should also always store eggs at 40 degrees F or colder before using them, to ensure the eggs are safe to eat, the CDC says. Cook eggs until they’re firm, which happens around 160 degrees F (far lower than the temperature needed to bake cookies) to reduce the chance they’ll make you sick. But eggs are far from the only ingredient in cookie dough that can make someone sick if left uncooked. “Flour is one of the main components of cookie dough, and a lot of the time people don’t think flour can be harmful, but it can contain bacteria because it’s not heated when it’s processed,” Czerwony says. Flour can be contaminated with bacteria at various stages, whether it’s in the field before harvest, during the milling process, or in someone’s kitchen. “We want to make sure that we don’t eat raw flour. We need to heat it to at least 140 degrees F to kill any bacteria,” Czerwony says. In 2009, the CDC investigated an outbreak that infected 72 people with Escherichia coli, also known as E. coli, in which 34 people had to be hospitalized. The agency quickly traced the source to premade refrigerated cookie dough. A further investigation revealed that contaminated flour was the most likely cause. As many as 10 percent of people who get sick from an E. coli infection develop a potentially life-threatening complication known as hemolytic uremic syndrome, a condition that causes damage to red blood cells, resulting in kidney failure, which comes on about seven days after symptoms first appear, according to the CDC. “This is not just about cookie dough,” says Dr. Ahn. “The same risk applies to brownie and cake batter or any other dough that uses similar ingredients.” Even after it’s cooked, the mishandling of dough or its ingredients can cause foodborne illness. Pay special attention to chocolate and nuts, which can harbor harmful bacteria, notes Ahn. She recommends against eating any cookie or treat with these ingredients until it’s fully cooked. “Contamination of chocolate and chocolate chips or nuts contaminated with salmonella is not uncommon,” she says. Be sure to avoid leaving cookie dough out for hours and then cooking it, cautions Czerwony. That allows time for bacteria to grow. “I don’t want to take the fun out of making cookies, but just be mindful; you don’t want [the experience] to get ruined by a foodborne illness,” she says

Some brands, such as Deux and Pillsbury, make special cookie dough in which the flour is heated to a safe temperature before it’s mixed into dough. Pillsbury’s Ready to Bake Cookie Dough also uses pasteurized eggs, while Deux’s is egg free, gluten free, and vegan. The pasteurization process carefully heats eggs in water baths. This kills bacteria that can make you sick, but doesn’t cook the egg, meaning these eggs can still be used in the same way a raw egg would be, according to the United States Department of Agriculture (USDA). If you must eat cookie dough — and Ahn says she still would not ever recommend it — “make sure the cookie dough products are made with heat-treated flour and pasteurized eggs, and avoid dough with too many other ingredients,” she says.