Yak milk is a widely consumed dairy product rich in lactic acid bacteria. Although Enterococcus hirae (E. hirae) is commonly found in dairy products and other foods, there is limited information available on its genetic makeup in yak milk. In the present study, 10 E. hirae strains isolated and identified from fresh white yak milk samples, along with 442 E. hirae strains obtained from the NCBI database (totaling 452 strains), were subjected to comparative genomic analysis. The findings of this study revealed that E. hirae has an open pan-genomic structure that allows for its high adaptability and environmental plasticity. Notably, E. hirae isolates from fresh white yak milk had smaller genomes, encoded more functional genes, and had fewer copies of genes encoding carbohydrate-active enzymes involved in the degradation of oligosaccharide metabolism and autolysin synthesis (CE1, GH73, GH23, and GT4 families) than those from animal and human isolates (P <
0.05). Additionally, fresh white yak milk isolates carried only three intrinsic bacteriocins and lacked virulence factors, CRISPR-Cas systems, and resistance genes linked to pathogenicity, which may be attributed to their specialization in the milk-derived environment. This study provides new insights into the genetic and functional gene diversity of E. hirae and how it adapts to milk-derived habitats.