Ergothioneine (EGT) is a histidine betaine derivative that exhibits antioxidant action in humans. EGT is primarily synthesized by fungal species and a number of bacterial species. A five-gene cluster (egtA, egtB, egtC, egtD & egtE) responsible for EGT production in Mycobacteria smegmatis has recently been identified. The first fungal biosynthetic EGT gene (NcEgt-1) has also been identified in Neurospora crassa. NcEgt-1 contains domains similar to those found in M. smegmaris egtB and egtD. EGT is biomembrane impermeable. Here we inferred the evolutionary history of the EGT cluster in prokaryotes as well as examining the phyletic distribution of Egt-1 in the fungal kingdom. A genomic survey of 2509 prokaryotes showed that the five-gene EGT cluster is only found in the Actinobacteria. Our survey identified more than 400 diverse prokaryotes that contain genetically linked orthologs of egtB and egtD. Phylogenetic analyses of Egt proteins show a complex evolutionary history and multiple incidences of horizontal gene transfer. Our analysis also identified two independent incidences of a fusion event of egtB and egtD in bacterial species. A genomic survey of over 100 fungal genomes shows that Egt-1 is found in all fungal phyla, except species that belong to the Saccharomycotina subphylum. This analysis provides a comprehensive analysis of the distribution of the key genes involved in the synthesis of EGT in prokaryotes and fungi. Our phylogenetic inferences illuminate the complex evolutionary history of the genes involved in EGT synthesis in prokaryotes. The potential to synthesize EGT is a fungal trait except for species belonging to the Saccharomycotina subphylum. (C) 2014 Elsevier B.V. All rights reserved.