But sometimes the same bloating and pain can be symptoms of a health condition, in which case a doctor’s visit is in order, says Abdullah Shatnawei, MD, a gastroenterologist and hepatologist, and medical director of the Center for Gut Rehabilitation and Transplantation at the Cleveland Clinic in Ohio. Usually other signs will indicate when stomach gas isn’t to blame.

You feel the urge to pass gas or to belch.You get relief from the bloating and pain when you pass gas.Your pain and bloating don’t persist or worsen.Excessive gas and bloating get better when you make certain changes to your diet, like eliminating dairy, cutting back on fiber, or limiting high-fat foods.Pain and bloating improve when you swallow less air, which is what happens when, for example, you chew gum or eat too quickly.

Here are just a few possible causes of abdominal pain and bloating:

ConstipationLactose intolerance or another food intolerance or allergyGastroesophageal reflux disease (GERD) or indigestionIrritable bowel syndrome (IBS)Kidney stones, gallstones, or an inflamed gallbladderCrohn’s disease or ulcerative colitis (inflammatory bowel disease)An ulcer in the digestive tractAppendicitisAn obstruction in the bowelA tumor in the abdomen

In most of these cases, you will notice symptoms other than just gas and bloating. For instance, in the case of appendicitis, there will most likely be changes to your abdomen, including stiffness and extreme tenderness. Gas pain doesn’t make your belly sensitive to the touch, so if you notice extreme pain, always seek medical advice. If your pain, bloating, and excessive gas problems are persistent, take steps to find out the cause.

Diagnosing the Problem

A physical exam and diagnostic tests may be performed to help rule out other more serious medical conditions that could be mimicking excessive gas pain. If lactose intolerance is suspected, your doctor may schedule you for a breath test. Depending on the potential causes, other tests may include blood work, imaging — such as X-ray or computerized tomography (CT) — and endoscopy. “Excessive gas that causes bloating and discomfort can be a challenging condition to treat,” says Shatnawei. “It often requires a change in lifestyle, which isn’t always easy. You may have to adjust your diet. For example, carbohydrates can make bloating worse. Sometimes avoiding carbonated beverages, chewing gum, legumes (like beans and lentils) or cruciferous vegetables (like cauliflower) may help.” Sensitivity to gluten can also cause bloating. “But sensitivity to gluten does not necessarily imply celiac disease,” cautions Shatnawei. It’s best to seek medical advice before eliminating gluten from your diet. Constipation can also contribute to bloating. Exercise can help. If an imbalance in the gut bacteria in the small bowel is suspected, probiotics may help, Shatnawei says. If you have persistent excessive gas, abdominal pain, or bloating, and can’t get relief, it’s a good idea to head to your doctor. If the problem is intestinal gas, he can recommend ways to provide relief. And if it’s a more serious problem, you can catch it early and get started on treatment.