Travelers who deboard airplanes may feel relieved to be out of a cramped cabin and away from the bad in-flight movie. But sometimes there’s still a bit of physical discomfort as some passengers report feeling bloated or having to pass gas after a flight. Here’s the reason why.

Post-flight flatulence, which is sometimes playfully described as HAFE, or High-Altitude Flatus Expulsion, is triggered by simple physics. When we’re on board airplanes, the air pressure decreases as altitude increases. Because we have air in the bowel—and more of it depending on the gases produced by foods we eat or air we swallow—the lowered pressure means those gases expand, creating a need to release them via the reliable method of farting.

Going from low to high altitudes quickly may also prevent carbon dioxide from dissolving in the bloodstream and causing it to diffuse in the bowel, leading to increased gastrointestinal pressure. (This was verified in a 2013 study in which Australian scientists drove subjects up a mountain resort to an altitude of about 5900 feet. Farts nearly doubled compared to flatulence experienced prior to the ascent and were present even 11 hours following the trip. Another example of science working for everyone.)

As for why gas seems to feel a bit more uncomfortable after getting off a flight, you can thank cramped cabins. Being seated for too long can trap air in the bowel. By the time you’re off the plane, you might feel a bit overstuffed.

If post-flight flatulence is an issue, it’s best to avoid gas-causing foods like broccoli and beans as well as carbonated beverages. Some physicians even recommend avoiding foods that fall under the FODMAP, or Fermentable Oligo-, Di, Mono-saccharides And Polyols, list. That means milk, yogurt, certain vegetables, and artificial sweeteners.

The most important tip? Get up and walk. In addition to keeping gas from getting trapped, you’ll avoid complications from sitting too long, like deep vein thrombosis, or DVT, a blood clot that forms in the legs and can lead to pulmonary embolisms.

[h/t MSN]