Flies (often used in the singular fly) are an opening at the front of trousers and men's briefs or boxer shorts to allow the penis to be taken out for toileting or other purposes without having to pull down the whole garment. Because of this, flies can be a fetish, especially for gay men. Flies on trousers are also often needed to allow the trousers to be put on, as most trousers do not have waistbands stretchy enough to go over the hips without them.
Some men's underwear, such as slips, do not have flies.
Flies on trousers generally have some way to keep them closed, usually nowadays a zip though a few (especially jeans) still have buttons. Underwear and pyjama trousers rarely have fasteners on the flies, although buttons are found occasionally.
A fly is not just the zip opening; it also has a fastener across the top so that the trousers do not fall down when the zip is opened. This is usually a button or hook fastening. It may be opened to allow the trousers to be put on or removed. On underwear, there is no break in the waistband above the flies as the waistband is stretchy enough not to need one.
Women's trousers and skirts may also have flies to allow them to be put on, though often they rely on an elastic waistband or just a zip without any fastener across the top. The flies are generally in the front, but as the toileting arrangements are different from those for men, it is possible to have women's flies at the side or rear of the waistband.