Bacterial genomes have been shaped by a complex evolutionary history, including extensive homologous recombination, horizontal gene transfer, gene loss, and gene duplications. A pan-genome, consisting of all genes within a defined set of bacterial genomes, can provide the basis for phylogenetic inferences and population studies.Here we introduce PEPPA, a pipeline that can construct a pan-genome from thousands of genetically diversified bacterial genomes. PEPPA implements a combination of treeand synteny-based approaches to identify and exclude paralogous genes, which facilitates the ready construction of schemes for whole genome multi-locus sequence typing (wgMLST) and core genome MLST. PEPPA also implements similarity-based gene predictions that support consistent annotations of genes and pseudogenes in individual genomes, and which are nearly as accurate as expert manual curation. The PEPPA package includes PEPPA_parser, which calculates trees based on accessory gene content and MLST core genome allelic differences. We also present SimPan, a novel pipeline for simulating the evolution of a bacterial pan-genome. PEPPA was compared with four state-of-the-art pan-genome pipelines on both empirical and simulated datasets. It demonstrated greater accuracy and specificity than any other pipeline, and was almost as fast as any of them at calculating a pan-genome. To demonstrate its abilities, PEPPA was used to construct a Streptococcus pan-genome of >40,000 genes from 3,170 representative genomes spanning at least 80 species. The resulting gene and allelic trees provide an unprecedented overview of the genomic diversity of this genus. Kilian M, Poulsen K, Blomqvist T, Havarstein LS, Bek-Thomsen M, Tettelin H, Sorensen UB. 2008. Evolution of Streptococcus pneumoniae and its close commensal relatives. PLoS ONE 3: e2683. Kilian M and Tettelin H. 2019. Identification of virulence-associated properties by comparative genome analysis of Streptococcus pneumoniae, S. pseudopneumoniae, S. mitis, three S. oralis subspecies, and S. infantis. MBio 10. Konstantinidis KT, Rossello-Mora R, Amann R. 2017. Uncultivated microbes in need of their own taxonomy. ISME J 11: 2399-2406. Koonin EV. 2016. Splendor and misery of adaptation, or the importance of neutral null for understanding evolution. BMC Biol 14: 114.