A toilet's drain pipe is part of an overall drain-waste-vent (DWV) system that connects the toilet and other fixtures within a home to the main drain line. Not only are there drainpipes and waste pipes that carry water and waste, but also pipes that vent sewer gases out of the piping system.
The pipe that the toilet is directly connected to is the drainpipe located directly underneath the toilet. This drainpipe must have a minimum diameter of 3 inches. Depending on how many toilets are in the home, the drainpipe will be either 3 or 4 inches. The top of the toilet's drainpipe connects to a closet flange and has a closet bend on the bottom of it so that it can connect to the pipe that transports the waste and water.
The closet bend on the bottom of the toilet drainpipe connects to a vertical pipe that slopes downward. This downward slope, which is usually approximately 1/8 to 1/4 inch per foot of pipe length, is vital so that gravity can work to transport the water and waste away. This sloping pipe will be either 3 or 4 inches in diameter, the same as the drainpipe hooked up to the closet flange.
The toilet's sloping pipe runs to the 4-inch soil stack, also called a soil vent. This vertical piping connects to the system's outgoing sewer/septic line. The top of the soil vent is visible on the roof of the house as the top of the pipe extends through the roof, which allows sewer gases to escape, or vent, to the fresh air outside. The soil vent also allows fresh air into the system, which allows for steady, efficient flow in the drains.
The supply pipe, which transports water to the toilet, usually comes out of the wall directly behind the toilet's left side. Otherwise, the pipe enters up through the floor. On the end of it is installed a shutoff valve, which allows you to regulate the water pressure of water entering the toilet. You can also totally shut off the water to the toilet at this valve. One end of a rigid tube or a flexible hose connects to the shutoff valve, and the other end connects to the toilet tank, which provides the supply pipe's connection to the toilet.