When we cut an onion, sulfur-containing compounds are released. These compounds react with air and create an unpleasant gas (sulfur oxides). When it reaches our eyes, irritation occurs and it sends signals to our tear gland to produce tears. So that the tears can wash away the irritant from your eyes. But it can be avoided by following some simple rules.
1) Wear Swim goggles to protect eyes from irritation. Goggles will restrain the irritating gas from reaching to the eyes.
2) Light a candle or just turn on the stovetop flame. Cut the onion standing near to the flame. Open flame pulls the air and fumes towards itself. So that less fumes reach to the eyes causing less irritation.
3) Use sharp knife to cut the onion. It damages less cells. It will reduce the amout of gas released from the onion which cut down the chances of tears.
4) While cutting an onion, first remove the root part of the onion which most of the sulfur compounds which releases irritating gas. Do not dispose the root part. Cut the the remaining onion first and then chop the root part. That is how it will reduce the time to cut the actual gas releasing part of onion.