Gas is primarily composed of hydrogen, nitrogen, and carbon dioxidewhich are all odorless. In about one-third of people, gas also contains methane. Its unclear why some people produce methane and some people do not. People who produce methane typically will have stools that float in water.
Sulfur is what causes gas to have odor. Therefore foods that are high in sulfur, such as garlic, onions, leeks, broccoli, cauliflower, cabbage and Brussels sprouts, can cause foul-smelling gas.
Why do beans cause gas?Beans (legumes) cause gas because they contain a sugar, oligosaccharide, that the human body can not break down. Oligosaccharides are large molecules and are not broken down and absorbed by the lining of the small intestine as other sugars are. This is because the human body does not produce the enzyme that breaks down oligosaccharides.
Oligosaccharides make it all the way through the GI tract to the large intestine still intact. The bacteria that live in the small intestine break down the oligosaccharides. This produces the gas that must eventually come out of the rectum.
By the same principal, other foods that come into the large intestine without being properly absorbed in the small intestine will cause gas. Stress, for example, can cause food to move through the GI tract too quickly to be properly digested, with the end result being gas in the large intestine.
Preventing gasTo prevent gas that is caused by eating beans, the oligosaccharides must be broken down before they reach the large intestine and become food for the resident bacteria. The enzyme that breaks down oligosaccharides is alpha-galactosidase. This enzyme is derived from the fungus Aspergillus niger and is available under the brand name Beano.
Alpha-galactosidase is not appropriate for people with diabetes, as it may lead to an increase in blood sugar level. People who have mold allergies may have a reaction to alpha-galactosidase. Alpha-galactosidase may increase galactose levels and therefore should not be used by those who have the genetic disease galactosemia.

