RNA interference (RNAi) is an important defence against viruses and transposable elements (TEs). RNAi not only protects against viruses by degrading viral RNA, but hosts and viruses can also use RNAi to manipulate each other's gene expression, and hosts can encode microRNAs that target viral sequences. In response, viruses have evolved a myriad of adaptations to suppress and evade RNAi. RNAi can also protect cells against TEs, both by degrading TE transcripts and by preventing TE expression through heterochromatin formation. The aim of our review is to summarize and evaluate the current data on the evolution of these RNAi defence mechanisms. To this end, we also extend a previous analysis of the evolution of genes of the RNAi pathways. Strikingly, we find that antiviral RNAi genes, anti-TE RNAi genes and viral suppressors of RNAi all evolve rapidly, suggestive of an evolutionary arms race between hosts and parasites. Over longer time scales, key RNAi genes are repeatedly duplicated or lost across the metazoan phylogeny, with important implications for RNAi as an immune defence.