Stomach pain paired with diarrhea usually means something is irritating or inflaming your intestinal lining. The most common cause is viral gastroenteritis, often called a “stomach bug,” which typically resolves on its own within one to three days. But infections aren’t the only explanation. Food intolerances, medications, stress, and chronic digestive conditions can all produce the same combination of cramping and loose stools.
What’s causing yours depends on how quickly symptoms appeared, how long they’ve lasted, and what else is going on in your body. Here’s how to narrow it down.
Viral and Bacterial Infections
Infections are the single most common reason for sudden stomach pain and diarrhea. Viruses like norovirus cause symptoms within 12 to 48 hours of exposure and typically clear up in one to three days. Rotavirus tends to hit harder in young children and can last five to seven days. Adenovirus infections are slower to resolve, sometimes lingering 10 days or more.
Bacterial infections follow a similar pattern but often come from contaminated food or water. Salmonella symptoms start 6 to 48 hours after eating the contaminated food and usually last one to four days. Campylobacter infections run about a week. Some strains of E. coli take one to three days to produce symptoms, while the more dangerous O157:H7 strain can cause watery diarrhea that turns bloody within the first few days.
Food poisoning from toxin-producing bacteria like Staphylococcus aureus or Bacillus cereus works differently. Because the toxin is already present in the food when you eat it, symptoms hit fast, sometimes within 30 minutes, and usually ease within 24 hours. If your symptoms came on suddenly after a meal and are already fading, a bacterial toxin is the likely culprit.
Food Intolerances
If your stomach pain and diarrhea show up repeatedly after eating certain foods, an intolerance is worth considering. Unlike a food allergy, which involves your immune system and can cause life-threatening reactions, a food intolerance means your body struggles to digest a particular substance. Symptoms usually appear a few hours after eating the trigger food.
Lactose intolerance is the most common type. Your body lacks enough of the enzyme needed to break down the sugar in milk and dairy, so undigested lactose ferments in your colon, producing gas, bloating, cramps, and diarrhea. Fructose, the sugar found in fruit and honey, causes similar problems in some people. Sugar alcohols like sorbitol and xylitol, commonly used in sugar-free gum and candy, are another frequent trigger because they draw water into the intestines.
The pattern matters here. If you notice symptoms after dairy, fruit juice, or sugar-free products but feel fine otherwise, try removing the suspected food for a couple of weeks and see if things improve.
Medications That Upset Your Gut
Nearly any medication can cause diarrhea, but some are particularly notorious. Antibiotics top the list. They work by killing bacteria, but they don’t discriminate between harmful bacteria and the beneficial ones that keep your gut in balance. When that balance shifts, diarrhea follows. In some cases, antibiotics allow a bacterium called C. difficile to overgrow, which can cause severe, watery, and sometimes bloody diarrhea. This typically starts 5 to 10 days after beginning the antibiotic but can appear up to two months later.
Other common offenders include magnesium-containing antacids, metformin (used for diabetes), NSAIDs like ibuprofen and naproxen, and proton pump inhibitors used for heartburn. Even herbal teas containing senna or other natural laxative ingredients can trigger diarrhea. If your symptoms started shortly after beginning a new medication or supplement, that’s a strong clue.
Stress and Anxiety
Your gut and brain are in constant communication through a network of nerves, and emotional stress can directly speed up or slow down your digestion. When you’re anxious or under pressure, your intestines may contract more forcefully, pushing food through before enough water can be absorbed. The result is cramping and loose stools. Some people notice this before exams, job interviews, or during periods of ongoing stress. The symptoms are real and physical, even though the trigger is emotional.
IBS and Other Chronic Conditions
When stomach pain and diarrhea keep coming back over weeks or months without an obvious infection or dietary trigger, a chronic condition may be responsible. Irritable bowel syndrome (IBS) is the most common. It’s diagnosed when you’ve had abdominal pain or discomfort for at least 12 weeks over the past year, along with changes in how often you go or what your stool looks like. A hallmark of IBS is that the pain often improves after a bowel movement. Intestinal spasms push stool through the colon too quickly for fluid to be absorbed, producing diarrhea.
Inflammatory bowel disease (IBD), which includes Crohn’s disease and ulcerative colitis, is less common but more serious. Unlike IBS, IBD involves actual inflammation and damage to the intestinal lining. It can cause bloody stool, weight loss, fatigue, and fever in addition to pain and diarrhea. The distinction matters because IBD requires different treatment and monitoring. If your symptoms include blood in your stool, unintentional weight loss, or persistent fatigue, those point more toward IBD or another condition that needs investigation.
Parasitic infections like Giardia can also mimic chronic gut problems. Giardia infections sometimes last several weeks and cause on-and-off diarrhea, bloating, and cramps that people may mistake for IBS before getting a proper diagnosis.
What’s Happening Inside Your Body
Whether the cause is a virus, bacteria, or something you ate, the basic mechanism is similar. When your intestinal lining is irritated or inflamed, it releases chemical signals that trigger two things: the muscles in your intestinal wall contract more forcefully (that’s the cramping), and the cells lining your intestines start secreting extra fluid instead of absorbing it (that’s the diarrhea). Some pathogens produce toxins that directly force your intestinal cells to pump water and electrolytes into the gut. Others invade the lining itself and trigger an inflammatory response. Either way, the combination of stronger contractions and excess fluid is what makes you feel like you need to run to the bathroom.
Staying Hydrated While You Recover
The biggest immediate risk from diarrhea isn’t the underlying cause. It’s dehydration. Every loose stool pulls water and electrolytes out of your body, and if you’re also vomiting, the losses add up quickly. The World Health Organization recommends oral rehydration solutions, which are simple mixtures of clean water, salt, and sugar designed to be absorbed efficiently in the small intestine even when you’re sick.
You don’t necessarily need a commercial product. Clear broths, diluted fruit juices, and small sips of water with a pinch of salt can help. The goal is to replace fluids steadily rather than drinking large amounts at once, which can trigger more cramping. Signs of dehydration to watch for include dark urine, dry mouth, dizziness when standing, and in children, fewer wet diapers or no tears when crying.
Signs You Need Emergency Care
Most episodes of stomach pain and diarrhea resolve on their own, but certain warning signs mean you should seek care right away. These include pain so severe it stops you from functioning normally, inability to keep any liquids down, bloody or black stools, high fever, and symptoms that are getting worse rather than better after 48 hours. If you’ve had recent abdominal surgery and develop new pain with diarrhea, that also warrants urgent evaluation. For otherwise healthy adults, a mild stomach bug is uncomfortable but manageable at home. For young children, elderly adults, and people with weakened immune systems, dehydration can become dangerous faster, so the threshold for seeking help should be lower.

