A P-trap is the U-shaped bend of pipe installed in the drain line directly below a plumbing fixture such as a sink, lavatory, tub, or shower. The bend always holds a small amount of water, called the trap seal, which stops sewer gases from coming back up through the drain while still letting wastewater flow out. The name comes from its shape: the U-bend plus the horizontal trap arm that runs to the wall look like a sideways letter P.
Model plumbing codes require every fixture to be trapped, and most require a trap seal depth between 2 and 4 inches. The trap only works if it is vented, because an unvented trap can be siphoned dry when water rushes through the line. S-traps, which drop straight down into the floor without a vented trap arm, are prohibited by modern codes for that reason. Toilets have a trap built into the bowl, so they do not get a separate P-trap.