What Causes Flatulence and How to Reduce It

Flatulence comes from two sources: air you swallow and gas produced by bacteria fermenting undigested food in your large intestine. Passing gas between 14 and 23 times a day is normal, though most episodes go unnoticed. When flatulence becomes excessive or unusually smelly, the cause is almost always traceable to what you’re eating, how you’re eating it, or how your gut is processing food.

How Your Gut Produces Gas

Your small intestine absorbs most nutrients from food, but certain carbohydrates resist digestion and pass intact into the colon. There, trillions of bacteria feed on these undigested carbohydrates through fermentation, producing gas as a byproduct. The process is essentially the same as yeast fermenting sugar to produce carbon dioxide in bread dough, except it’s happening inside you.

Five odorless gases make up about 99% of what you pass: nitrogen, oxygen, carbon dioxide, hydrogen, and methane. The proportions vary wildly from person to person. Hydrogen can range from 0% to 86% of a given episode, and nitrogen from 11% to 92%, depending on your gut bacteria and recent meals. The speed of fermentation matters too. Shorter carbohydrate chains, like the oligosaccharides found in beans and lentils, ferment rapidly and produce more noticeable gas than longer-chain fibers, which break down slowly.

Why Some Foods Cause More Gas

The carbohydrates most likely to cause flatulence share three traits: they’re poorly absorbed in the small intestine, they’re small enough to draw water into the gut, and bacteria ferment them quickly. These are collectively known as FODMAPs, a group that includes the sugars in beans, onions, garlic, wheat, certain fruits, and dairy products.

Beans are a classic offender because they’re rich in raffinose-family oligosaccharides, sugars that humans lack the enzyme to break down. Onions and garlic contain fructans, another type of rapidly fermented carbohydrate. Stone fruits, apples, and pears contain polyols (sugar alcohols) that only partially absorb in the small intestine. Artificial sweeteners like sorbitol and xylitol work the same way, which is why sugar-free gum and candy can cause surprising amounts of gas.

Cruciferous vegetables like broccoli, cauliflower, and cabbage contain both fermentable carbohydrates and sulfur compounds, making them a double contributor: more gas, and smellier gas.

What Makes Gas Smell

The five main gases in flatulence are odorless. The smell comes from trace sulfur compounds, primarily hydrogen sulfide, produced when gut bacteria break down sulfur-containing amino acids from protein. In Western diets, dietary protein is the more significant source of hydrogen sulfide production, and fecal sulfide concentrations increase proportionally with meat intake. Foods especially high in sulfur-containing compounds include red meat, eggs, cheese, and cruciferous vegetables. A high-protein, meat-heavy diet will generally produce more pungent gas than a plant-based one.

Swallowed Air

Not all flatulence comes from fermentation. You swallow small amounts of air constantly, and certain habits increase that volume substantially. Eating too fast, talking while eating, chewing gum, sucking on hard candy, drinking through straws, and consuming carbonated drinks all push extra air into your digestive tract. Smoking does the same. Most swallowed air exits as burps, but whatever passes beyond the stomach travels through the intestines and exits as flatulence.

Some people swallow air excessively without realizing it, a pattern called aerophagia. Anxiety and stress can trigger it, as nervous habits often involve repeated swallowing. People who use CPAP machines for sleep apnea sometimes swallow pressurized air during the night. Poorly fitting dentures cause the mouth to produce more saliva, leading to more frequent swallowing and more ingested air.

Lactose Intolerance and Enzyme Deficiencies

If dairy consistently gives you gas, the reason is straightforward. Lactase, the enzyme that breaks down lactose (the sugar in milk), is produced in decreasing amounts after childhood in roughly 68% of the world’s population. Without enough lactase, lactose passes undigested into the colon, where bacteria ferment it and produce hydrogen, carbon dioxide, methane, and hydrogen sulfide. The result is gas, bloating, and often diarrhea within a few hours of consuming milk, ice cream, or soft cheese.

The severity depends on how much lactase you still produce. Some people can handle a small glass of milk without trouble but react to a large latte. Hard cheeses and yogurt contain less lactose and are often better tolerated.

Gut Conditions That Increase Gas

When flatulence is persistent and disruptive, an underlying digestive condition may be involved. Two of the most common are irritable bowel syndrome (IBS) and small intestinal bacterial overgrowth (SIBO).

In SIBO, bacteria that normally live in the colon proliferate in the small intestine, where they start fermenting food earlier in the digestive process. Two-thirds of people with SIBO report excessive gas, bloating, abdominal cramps, and altered bowel habits. When the overgrowth involves methane-producing organisms, constipation is the dominant symptom rather than diarrhea. SIBO is diagnosed through breath testing, though the tests have limited accuracy: sensitivity ranges from about 42% to 55% depending on the method used.

IBS can amplify the perception of gas even when the volume produced is normal. People with IBS often have heightened sensitivity in their intestinal walls, meaning a normal amount of gas causes disproportionate discomfort and bloating. A low-FODMAP diet, which removes the most rapidly fermented carbohydrates, reduces both gas production and symptoms in many IBS and SIBO patients by depriving gut bacteria of their preferred fuel.

Medications That Cause Gas

Several common medications increase gas as a side effect, usually by disrupting digestion or altering the gut’s bacterial balance. Metformin, widely prescribed for type 2 diabetes, causes gastrointestinal symptoms in up to one in three users, with gas, diarrhea, and nausea being the most frequent complaints. Antibiotics can shift the balance of gut bacteria, sometimes killing off populations that keep gas-producing species in check. This disruption can cause watery diarrhea and increased flatulence that may persist for weeks after the course ends.

Opioids cause constipation in about 40% of users, and constipation itself leads to more fermentation time in the colon, producing more gas. Fiber supplements and laxatives taken to counteract constipation can then add another layer of fermentation. SSRIs and other antidepressants sometimes cause gastrointestinal side effects early in treatment, though these tend to be short-lived. Proton pump inhibitors, used for acid reflux, have also been linked to increased gas and bloating.

Reducing Excessive Flatulence

The most effective approach is identifying which foods trigger your gas and reducing them. Keeping a food diary for two to three weeks, noting what you eat and when symptoms peak, often reveals clear patterns. A temporary low-FODMAP diet can help isolate the culprits, after which you reintroduce foods one at a time to find your personal threshold.

Over-the-counter options have mixed results. Alpha-galactosidase (sold as Beano) is a digestive enzyme that breaks down the oligosaccharides in beans and vegetables before gut bacteria can ferment them. In a randomized controlled trial, it reduced the proportion of people experiencing flatulence from 48% to 19% compared to placebo, and cut the number of days with significant bloating nearly in half. Simethicone, the active ingredient in Gas-X, works by merging small gas bubbles into larger ones that are easier to pass. It can relieve the feeling of pressure, but clinical evidence for its effectiveness is weak. Activated charcoal and most probiotic supplements show similarly limited results in trials.

For lactose intolerance, lactase enzyme tablets taken before dairy can prevent symptoms. Eating more slowly, avoiding carbonated drinks, and cutting back on gum and hard candy address the swallowed-air component. If dietary changes don’t help and gas remains excessive, breath testing for SIBO or evaluation for other digestive conditions is a reasonable next step.