What Causes an Upset Stomach and When to Worry

An upset stomach is most often caused by something you ate, a virus you picked up, stress, or a medication you’re taking. While the discomfort usually resolves on its own within a day or two, the underlying causes range from a simple dietary irritant to a chronic digestive condition. Understanding what’s behind your symptoms can help you figure out whether you need to change a habit, wait it out, or get checked.

Viral and Bacterial Infections

Infections are one of the most common reasons for sudden stomach upset. Norovirus alone accounts for roughly half of all viral gastroenteritis cases and 90% of epidemic diarrheal outbreaks worldwide. Rotavirus, adenovirus, and astrovirus cause most of the remaining viral cases. These viruses spread through contaminated food and water, contact with contaminated surfaces, and even aerosolized vomit particles.

Bacterial infections from Salmonella, E. coli, Campylobacter, and Shigella tend to produce more severe symptoms, including bloody stool, high fever, and intense cramping. The CDC estimates that just seven major foodborne pathogens cause about 9.9 million illnesses, 53,300 hospitalizations, and 931 deaths each year in the United States.

How Quickly Food Poisoning Hits

The time between eating contaminated food and feeling sick varies significantly by pathogen. Norovirus and Salmonella both have a median incubation period of about 32 hours, though Salmonella can take anywhere from 7 hours to over 5 days. Campylobacter typically takes longer, with a median of 62 hours (roughly 2.5 days). Shiga toxin-producing E. coli is the slowest, with a median of about 87 hours, or close to 4 days after exposure.

This timing matters. If your stomach turns within a few hours of a meal, the culprit is likely a toxin produced by bacteria (like Staphylococcus aureus) rather than an active infection. If symptoms appear one to three days later, a virus or bacterial infection is more probable.

Pain Relievers and Other Medications

Over-the-counter pain relievers like ibuprofen, aspirin, and naproxen are among the most frequent medication-related causes of stomach trouble. These drugs work by blocking enzymes called COX-1 and COX-2, which reduces pain and inflammation but also strips away the protective chemical layer that shields your stomach lining from its own acid.

The damage goes beyond just removing that protective barrier. These medications also trigger abnormal stomach contractions. The hypercontraction compresses the folds of the stomach lining, restricting blood flow to those areas. This creates a cycle of reduced circulation followed by sudden blood return, which generates tissue-damaging molecules. The result can range from mild nausea and burning to visible erosions or ulcers with repeated use. Taking these medications with food or switching to alternatives that target COX-2 more selectively can reduce the risk.

Stress and the Gut-Brain Connection

Your brain and your gut are in constant two-way communication through the vagus nerve, which runs from the brainstem to the abdomen. When you’re anxious or under stress, your body activates its stress response system, releasing cortisol and other hormones. This has a direct, physical effect on your digestive tract: it slows stomach emptying, alters the rhythmic contractions that move food through your intestines, and increases activity in the lower colon.

Stress also triggers immune cells in the gut wall to release histamine and other inflammatory compounds, which can cause muscle dysfunction in the digestive tract. This is why a stressful day at work or anxiety before a big event can produce very real nausea, cramping, or diarrhea. It’s not “in your head” in any dismissive sense. The nervous system is physically changing how your gut operates.

How Your Body Produces Nausea

Nausea itself is orchestrated by a specific region in the brainstem that sits outside the blood-brain barrier. Because this area is directly exposed to your bloodstream, it can detect toxins, medications, and inflammatory signals circulating in your blood and respond almost immediately. It collects information from two sources: chemical signals in the blood and nerve signals traveling up from your stomach and intestines via the vagus nerve.

This brainstem region then relays the combined input to nearby nerve centers, which coordinate the physical act of vomiting, including the diaphragm contractions, the closing of the airway, and the reversal of normal digestive movement. This system evolved as a defense mechanism to expel harmful substances, which is why so many different triggers (infections, toxins, motion, medications, even strong emotions) all produce the same queasy feeling.

Food Intolerances

If your stomach consistently hurts after eating dairy, fruit juice, or foods sweetened with high-fructose corn syrup, a carbohydrate intolerance may be responsible. Lactose intolerance and fructose malabsorption are the two most common types. In both cases, your small intestine lacks sufficient enzymes or transport mechanisms to absorb the sugar. The undigested sugar passes into the colon, where it draws in extra water (causing loose stools) and gets fermented by gut bacteria (producing gas, bloating, and cramping).

These intolerances are dose-dependent. You might handle a splash of milk in your coffee but feel miserable after a bowl of ice cream. Keeping a food diary for a couple of weeks can help you identify patterns, especially if your symptoms are chronic but inconsistent.

IBS, IBD, and Chronic Stomach Issues

When stomach upset becomes a recurring pattern lasting months or years, two conditions come up most often: irritable bowel syndrome (IBS) and inflammatory bowel disease (IBD). They can feel similar on the surface but are fundamentally different.

IBS is a functional disorder, meaning the gut looks normal on scans and scopes but doesn’t work properly. The leading explanation is visceral hypersensitivity: the nerves in the gut overreact to normal sensations like stretching or gas, sending exaggerated pain signals to the brain. Symptoms can be severe, but there’s little to no measurable inflammation.

IBD, which includes Crohn’s disease and ulcerative colitis, involves ongoing, visible inflammation of the digestive tract. Even patients in remission who feel fine still show higher levels of inflammatory markers compared to people with IBS. A stool test measuring a protein called calprotectin can help distinguish the two: levels below 40 micrograms per gram suggest no significant inflammation, while levels above 100 point toward IBD. Values in between are less clear-cut.

One complicating factor is that IBS-like symptoms can appear years before an IBD diagnosis, and many IBD patients in remission develop IBS-type symptoms driven by nerve sensitivity rather than active inflammation. If you’ve had persistent digestive symptoms that don’t resolve with dietary changes, getting a proper evaluation can help determine which condition you’re dealing with and what treatment makes sense.

Other Common Triggers

Several everyday factors can cause stomach upset without involving infection or chronic disease:

  • Overeating or eating too fast. This physically stretches the stomach and can overwhelm digestive capacity, triggering nausea and bloating.
  • Alcohol. It irritates the stomach lining directly and increases acid production.
  • Caffeine. It stimulates acid secretion and can speed up gut motility, especially on an empty stomach.
  • Spicy or high-fat foods. Fat slows stomach emptying, leaving food sitting longer and producing that heavy, uncomfortable feeling. Capsaicin in spicy food activates pain receptors in the stomach lining.
  • Carbonated drinks. The gas itself can cause distension, bloating, and belching.

Warning Signs That Need Attention

Most upset stomachs resolve within 24 to 48 hours. But certain symptoms alongside nausea or stomach pain signal something more serious. Vomit that contains blood, looks like coffee grounds, or is green indicates potential bleeding or intestinal obstruction. Chest pain, severe abdominal cramping, confusion, or a combination of high fever with a stiff neck all require emergency evaluation.

Dehydration is the most common complication of prolonged vomiting or diarrhea. Signs include excessive thirst, dark urine, infrequent urination, dry mouth, and dizziness when standing. For mild dehydration, oral rehydration solutions (available at most pharmacies) work well because they contain a balanced ratio of sodium and glucose that helps your intestine absorb fluid efficiently. For children and older adults, dehydration can become dangerous faster, so monitoring fluid intake matters more in those groups.