Summary. It is common practice that some or all animals in a group of animals, e.g. a herd, are tested for their health status by using a diagnostic test to investigate whether the herd is infected by a disease. Several obstacles complicate the estimation of herd prevalence on the basis of test results of the animals. First, diagnostic tests are often imperfect, resulting in a misclassification of the animal's disease status. It is well known how to correct the animal's apparent prevalence by using the diagnostic sensitivity and specificity of the animal test, but the effects on herd prevalence are less clear. Second, in practice, a herd is often defined as positive when at least one sampled animal tested positively. This definition is ambiguous and is also different from the herd prevalence that is based on having at least one diseased animal in the herd. The paper provides a discussion of these aspects and proposes a method to estimate the true herd prevalence on the basis of the health status of (all or a sample of) animals within a herd corrected for the sensitivity and specificity of the individual test, the number of animals that are tested in the herd and the uncertainty of the diagnostic test characteristics.