What Does It Mean When You Fart in Your Sleep?

Farting in your sleep is completely normal. Healthy adults pass gas between 14 and 23 times over a 24-hour period, and a portion of that naturally happens overnight. Your body doesn’t stop digesting food when you fall asleep, and the muscles that normally help you hold gas in relax as you drift into deeper sleep stages. The result: gas escapes without you knowing.

Why Gas Builds Up While You Sleep

Your digestive system keeps working through the night, but it slows down considerably. During the deeper stages of non-REM sleep (stages 3 and 4), muscle tone throughout your body decreases, including in your gut. This slower digestion means food remnants linger longer in your intestines, where bacteria continue fermenting them and producing gas.

At the same time, the muscles around your anal sphincter relax. When you’re awake, you unconsciously tighten these muscles to hold gas in (or at least wait for a discreet moment). During sleep, that voluntary control disappears, so gas passes freely. You’re not producing dramatically more gas at night. You’re just less able to hold it in.

Late Meals Are the Biggest Culprit

If you eat a large meal and lie down shortly after, your GI system has to work harder to process it in a slower, horizontal position. That creates more opportunity for gas to build up. The general rule is to wait at least two hours after eating before you go to bed.

A few other habits that increase overnight gas:

  • Large evening meals. Eating a lot in one sitting means more undigested food reaching your large intestine, where bacteria ferment it and release gas. Smaller, more frequent meals throughout the day give your gut time to process food properly.
  • Carbonated drinks at night. The carbon dioxide in sparkling water, soda, or beer introduces extra gas directly into your digestive tract.
  • Chewing gum in the evening. You swallow small amounts of air with each chew, which adds up.

Foods That Make It Worse

Certain carbohydrates are harder for your body to break down in the small intestine, so they travel to the large intestine where bacteria ferment them and produce gas. The classic offenders include beans, lentils, broccoli, cabbage, onions, and whole grains. These are all healthy foods, so the goal isn’t to avoid them entirely, just to be aware that eating them at dinner will likely mean more gas overnight.

People with specific intolerances notice this effect more strongly. Lactose intolerance, for example, means the sugar in dairy products isn’t properly absorbed and ends up fermenting in the colon. The same applies to fructose intolerance, where certain fruits, honey, and high-fructose sweeteners cause excess gas. If your nighttime gas is consistently foul-smelling, that often points to protein-rich or sulfur-containing foods (eggs, meat, cruciferous vegetables) being broken down by gut bacteria.

CPAP Machines and Swallowed Air

If you use a CPAP machine for sleep apnea, it could be contributing to your nighttime gas. CPAP devices push a steady stream of pressurized air into your airway, and because the muscles in your esophagus relax during sleep, some of that air gets pushed into your stomach instead of just your lungs. This is called aerophagia, and it affects roughly 16% of CPAP users. The excess swallowed air causes bloating, burping, and flatulence.

A nasal mask tends to cause less air swallowing than a full-face mask. If you use a nasal mask, adding a chin strap to keep your mouth closed can also help. For full-face masks, making sure the seal is tight matters because a poor seal can cause the machine to compensate with higher pressure, pushing even more air into your stomach.

When Nighttime Gas Signals Something Else

Passing gas in your sleep on its own is not a medical concern. But if you’re consistently exceeding 23 episodes per day, or if the gas comes with other symptoms, something more may be going on.

Irritable bowel syndrome (IBS) is one of the more common causes of excessive gas. IBS involves a disruption in how the brain and gut communicate, which can affect how gas moves through the intestines and make you feel more bloated than the actual amount of gas would normally cause. Small intestinal bacterial overgrowth (SIBO) is another possibility, where an abnormal increase in gut bacteria produces extra gas along with diarrhea and sometimes weight loss.

Celiac disease, gastroparesis (delayed stomach emptying), and chronic constipation can all increase gas production as well. The key warning signs that suggest you should get checked out: sudden changes in your gas patterns, persistent abdominal pain, unexplained weight loss, or ongoing diarrhea or constipation alongside the gas. Any of these combinations points to something worth investigating rather than just a normal byproduct of digestion.

Simple Ways to Reduce Overnight Gas

Most nighttime gas responds well to straightforward changes. Finish eating at least two hours before bed. Shift your largest meal earlier in the day and keep dinner lighter. Cut back on carbonated drinks and gum in the evening hours. If you suspect a food intolerance, try eliminating dairy or high-fructose foods for a few weeks to see if it makes a difference.

Beyond diet, sleeping on your left side can help gas move through the colon more naturally, since the large intestine’s anatomy favors that position. Light movement after dinner, even a short walk, helps your digestive system process food before you lie down. These are small adjustments, but for most people they’re enough to noticeably reduce how much gas builds up overnight.