You fart in your sleep because your body keeps producing gas around the clock, but the muscles that normally help you hold it in relax as you drift off. The average person passes gas about 15 times a day, with a normal range anywhere from 3 to 40 times. A good portion of those happen overnight, and you simply sleep through them.
Your body produces between 400 and 2,000 milliliters of gas daily through two main sources: swallowed air and bacterial fermentation of food in your large intestine. Neither process stops when you fall asleep, so gas continues to build. What changes at night is your ability to consciously hold it back.
How Sleep Lowers Your Body’s Gas Gate
During waking hours, you have voluntary control over the external anal sphincter, the outer ring of muscle that acts as the final checkpoint for gas. You can squeeze it shut in social situations or relax it when you’re ready. When you fall asleep, that voluntary control fades. The deeper your sleep, the less tone these muscles maintain, which means gas passes more freely without any conscious decision on your part.
Your internal anal sphincter, the inner ring you can’t consciously control, also relaxes periodically during sleep as part of normal digestive reflexes. Together, these two muscles essentially open the door for gas that’s been accumulating in your colon. This is completely normal physiology, not a sign that something is wrong.
What You Ate Before Bed Matters
The biggest factor in how much gas your body produces overnight is what you ate in the hours leading up to sleep. Foods high in fermentable carbohydrates, like beans, lentils, broccoli, onions, whole grains, and carbonated drinks, give your gut bacteria more material to work with. That fermentation process generates hydrogen, methane, and carbon dioxide as byproducts. If you eat these foods at dinner or as a late-night snack, the peak of fermentation lines up with your sleeping hours.
Eating a large portion of your daily calories late at night compounds the issue. Research has linked consuming more than 25% of daily calories after 9 p.m. with increased digestive symptoms, including irregular bowel patterns. The gut slows down during sleep, so food eaten late sits longer in the intestines, giving bacteria more time to ferment it and produce gas. Shifting your heavier meals earlier in the day can noticeably reduce overnight flatulence.
Dairy products are another common culprit if you have any degree of lactose intolerance, which affects a large portion of adults worldwide. Undigested lactose reaches the colon and feeds gas-producing bacteria. An evening bowl of ice cream or glass of milk can translate directly into a gassy night.
Swallowed Air Adds Up
Not all gas comes from food breakdown. A surprising amount enters your digestive tract as swallowed air, a process called aerophagia. During the day, eating quickly, chewing gum, drinking through straws, and talking while eating all contribute. At night, mouth breathing is the primary source.
People who use CPAP machines for obstructive sleep apnea are especially prone to this. The machine delivers continuous airflow to keep the airway open, and getting more air than the body can expel leads to excess gas in the stomach and intestines. A chin strap can help keep the mouth closed and reduce air swallowing. Some people also benefit from switching to an automatic pressure machine (APAP), which adjusts airflow based on real-time need rather than delivering a constant stream.
Even without a CPAP, if you tend to sleep with your mouth open or have nasal congestion, you’re likely swallowing more air than someone who breathes through their nose.
Hormones Can Slow Your Gut Down
Hormonal fluctuations play a real role in gas production, particularly for people who menstruate. Progesterone, which rises in the second half of the menstrual cycle, slows the movement of food through the digestive tract. That slower transit time means more fermentation and more gas, sometimes called “PMS belly.” Bloating and flatulence often peak in the days before a period starts.
Menopausal women experience a similar effect from a different angle. Declining levels of estrogen and progesterone slow gut transit further, making constipation, bloating, and gas more common. Pregnancy amplifies these effects dramatically, as progesterone levels climb throughout the first and second trimesters.
Your Sleeping Position Changes Gas Flow
Gravity doesn’t stop working when you lie down, and the position you sleep in affects how gas moves through your intestines. Sleeping on your left side tends to encourage gas (and waste) to travel naturally through the colon. Your small intestine dumps contents into the large intestine through a valve in your lower right abdomen. When you lie on your left side, gravity helps move that material through the ascending colon, across the transverse colon, and down into the descending colon on the left side of your body.
This is actually a good thing for digestion and morning bowel regularity, but it also means gas moves through the system more efficiently and exits more readily. Sleeping on your right side or your back may slow that transit slightly, though it won’t eliminate gas altogether. If nighttime flatulence bothers you or a partner, experimenting with positions is one of the simpler adjustments to try.
When Gas Signals Something Else
Passing gas during sleep is normal, even if it happens frequently. But certain patterns deserve attention. If your gas symptoms change suddenly, become significantly worse than your baseline, or come alongside abdominal pain, persistent diarrhea, constipation, or unexplained weight loss, these could point to an underlying digestive condition. Irritable bowel syndrome, small intestinal bacterial overgrowth, celiac disease, and food intolerances can all increase gas production well beyond the typical range.
Excessive, foul-smelling gas that disrupts your sleep or your partner’s sleep is also worth bringing up with a doctor. In many cases, the fix is straightforward: identifying a trigger food, adjusting meal timing, or treating an underlying intolerance. A food diary tracking what you eat and when symptoms are worst can be a helpful starting point before any appointment.
Simple Ways to Reduce Nighttime Gas
- Eat dinner earlier. Giving your body three to four hours between your last meal and bedtime allows more digestion to happen while you’re still upright and your gut is more active.
- Identify trigger foods. Common gas producers include beans, cruciferous vegetables (broccoli, cauliflower, cabbage), onions, garlic, dairy, carbonated drinks, and artificial sweeteners like sorbitol.
- Slow down at meals. Eating quickly increases the amount of air you swallow, adding to the gas pool your body processes overnight.
- Move after eating. A short walk after dinner stimulates gut motility and helps your body process gas before you lie down.
- Address nasal congestion. If you breathe through your mouth at night, treating allergies or congestion can reduce the air you swallow during sleep.
- Try left-side sleeping. It aids overall digestion and can help your body clear gas more efficiently rather than letting it build up uncomfortably.

