BACKGROUND: The need for research on the safety of vaccination during pregnancy is widely recognized. Large, population-based data systems like the Vaccine Safety Datalink (VSD) may be useful for this research, but identifying pregnancies using electronic medical record (EMR) and claims data can be challenging. METHODS: We modified an existing data processing algorithm to identify pregnancies within seven of the ten VSD sites. We validated the algorithm by calculating the agreement in pregnancy outcome type, end date, and gestational age between the algorithm and manual medical record review. At each participating site, we randomly sampled 15 episodes within four outcome type strata (live births, spontaneous abortions, elective abortions, and other pregnancy outcomes) for a total of 60 episodes per site. We also developed and validated methods to link mothers to their infants in the electronic data. RESULTS: We identified 595,929 pregnancy episodes ending in 2002 through 2006 among women 12 through 55 years of age. Of these pregnancies, 75% ended in live births, 12% in spontaneous abortions, and 9% in elective abortions. We were able to confirm a pregnancy within 28 days of the algorithm-estimated pregnancy start date for 99% of live births, 93% of spontaneous abortions, 92% of elective abortions, and 90% of other outcomes sampled. The agreement between the algorithm-identified and the abstractor-identified outcome date ranged from 70% (elective abortion) to 96% (live birth) depending on outcome type. When gestational age was available in the EMR, agreement ranged from 82% (other) to 98% (live birth) depending on outcome type. We confirmed 100% of the 350 sampled mother-infant linkages with manual medical record review. CONCLUSIONS: The VSD algorithm accurately identifies pregnancy episodes and mother-infant pairs across participating sites. Additional manual record review may be needed to improve the precision of the pregnancy date estimates depending on specific study needs. These algorithms will allow us to conduct large, population-based studies of the safety of vaccination during pregnancy.