How does a pilot use the toilet mid-flight without anyone knowing about it?

Pilots have the ability to utilize the lavatory while in flight, albeit with adherence to stringent protocols aimed at upholding cockpit security. When there are two pilots on board, they make use of the restroom located closest to the cockpit. However, in the case of single-pilot aircraft, they have two options: either land the aircraft and utilize ground facilities or utilize specialized devices such as a catheter system or a purpose-built container for collecting urine. In the event of needing to defecate, pilots are required to land the aircraft and utilize a proper toilet.

Unlike passengers, pilots are unable to simply utilize the nearest restroom when the need arises. Due to privacy and security considerations, they have their own designated lavatory. It is worth noting, however, that the cockpit itself does not house any restroom facilities. Hence, when pilots need to relieve themselves, they take turns using the restroom situated nearest to the cockpit. If you observe closely during your next long-haul flight, you may catch a glimpse of the pilot emerging from the cockpit to utilize the lavatory. Nevertheless, certain protocols must be adhered to in order to ensure the safety of the aircraft.

It is crucial to understand that, by legal standards, a pilot is not permitted to initiate takeoff while a passenger is occupying the lavatory. This precaution is primarily due to the fact that takeoff and landing are considered the most critical and potentially hazardous phases of a flight. Lastly, it is important to mention that waste from airplane toilets is not stored on board. Instead, it is suctioned into a holding tank and subsequently disposed of at the airport.