The most common means of diagnosing pinworm infection is via the “Scotch tape” test, where a clear adhesive cellulose tape is applied to the anal area early in the morning before bathing or defecation. This is then observed under a microscope for the presence of pinworm eggs. These eggs may also be stained blue with lactophenol cotton blue, which aids in detection and identification. The sensitivity of this test when performed for three consecutive mornings is 90%. Anal swabs ("Swube tubes:" paddles coated with adhesive material) may also be used.
Alternatively, the adults may be seen in stool or toilet paper, though the ova and larvae are rarely present in either the stool or urine.Extra-intestinal infections may require more invasive diagnostic tests. One case diagnosed via colonscopy followed by confirmation via microscopy was documented by Petro et al. in 2005, and infections of the female genital tract usually require laparotomy and excision of granulomas for a conclusive diagnosis. Pre-operative diagnosis of finding the parasite via cervical smears, vaginal wet mounts, and vaginal pooled specimen is possible but difficult.