Genome modifications are central components of the continuous arms race between viruses and their hosts. The archaeosine base (G+), which was thought to be found only in archaeal tRNAs, was recently detected in genomic DNA of Enterobacteria phage 9g and was proposed to protect phage DNA from a wide variety of restriction enzymes. In this study, we identify three additional 2'-deoxy-7-deazaguanine modifications, which are all intermediates of the same pathway, in viruses: 2'-deoxy-7-amido-7-deazaguanine (dADG), 2'-deoxy-7-cyano-7-deazaguanine (dPreQ0) and 2'-deoxy-7- aminomethyl-7-deazaguanine (dPreQ1). We identify 180 phages or archaeal viruses that encode at least one of the enzymes of this pathway with an overrepresentation (60%) of viruses potentially infecting pathogenic microbial hosts. Genetic studies with the Escherichia phage CAjan show that DpdA is essential to insert the 7-deazaguanine base in phage genomic DNA and that 2'-deoxy-7-deazaguanine modifications protect phage DNA from host restriction enzymes.