Identifying rat and mouse species quickly, affordably, and accurately is crucial for effective population management, as well as for eradication or conservation purposes. However, the sheer diversity of these species poses a challenge. To address this, a molecular approach has been developed, involving the amplification of a short genetic marker from materials commonly left by the animal, such as hairs and feces. Recent available PCR primers were not suitable for the surveillance of large sample sizes. As a solution, this study designed and validated a PCR primer set capable of detecting five species of rats and mice (Mus musculus, Rattus tanezumi, Bandicota indica, Rattus tiomanicus, and Rattus argentiventer) commonly found in Java, Indonesia. The specific primers were derived from the cytochrome c oxidase subunit 1 (COI) gene, designed using the SP‐Designer V7.0 application, and validated using both in silico and in vitro methods. The validation results demonstrated that all five pairs of primers were highly specific, generated correct amplicons, and successfully detected the five distinct species present in a Javan mongoose feces sample. These findings are significantly important as they enable the effective detection of rat and mouse species and potentially provide valuable ecological insights from the field.