Accidentally swallowing or breathing in pinworm eggs causes a pinworm infection. The microscopic eggs can be carried to your mouth by contaminated food, drink or your fingers. Once swallowed, the eggs hatch in the intestines and mature into adult worms within a few weeks.
Female pinworms move to the anal area to lay their eggs, which often results in anal itching. When you scratch the itchy area, the eggs cling to your fingers and get under your fingernails. The eggs then get transferred to other surfaces, such as toys, bed linens or toilet seats. The eggs can also be transferred from contaminated fingers to food, liquids, clothes or other people.
Pinworm eggs can survive for two to three weeks on surfaces.