The gastrointestinal tracts of animals contain diverse communities of microbes that provide a number of services to their hosts. There is recent concern that these communities may be lost as animals enter captive breeding programmes, due to changes in diet and/or exposure to environmental sources. However, empirical evidence documenting the effects of captivity and captive birth on gut communities is lacking. We conducted three studies to advance our knowledge in this area. First, we compared changes in microbial diversity of the gut communities of two species of woodrats (Neotoma albigula, a dietary generalist, and Neotoma stephensi, which specializes on juniper) before and after 6–9 months in captivity. Second, we investigated whether reintroduction of the natural diet of N. stephensi could restore microbial diversity. Third, we compared the microbial communities between offspring born in captivity and their mothers. We found that the dietary specialist, N. stephensi, lost a greater proportion of its native gut microbiota and overall diversity in response to captivity compared with N. albigula. Addition of the natural diet increased the proportion of the original microbiota but did not restore overall diversity in N. stephensi. Offspring of N. albigula more closely resembled their mothers compared with offspring–mother pairs of N. stephensi. This research suggests that the microbiota of dietary specialists may be more susceptible to captivity. Furthermore, this work highlights the need for further studies investigating the mechanisms underlying how loss of microbial diversity may vary between hosts and what an acceptable level of diversity loss may be to a host. This knowledge will aid conservation biologists in designing captive breeding programmes effective at maintaining microbial diversity. Sequence Accession Numbers: NCBI's Sequence Read Archive (SRA) – SRP033616 We compared microbial community structure in two rodent species before and after captivity. One species lost a greater proportion of diversity in captivity, which was not rescued when they were returned to their natural diet. Mothers effectively transmitted microbiota to their offspring. These results have implications for captive breeding programs.