Influenza A virus’s (IAV’s) frequent genetic changes challenge vaccine strategies and engender resistance to current drugs. We sought to identify conserved and essential RNA secondary structures within IAV’s genome that are predicted to have greater constraints on mutation in response to therapeutic targeting. We identified and genetically validated an RNA structure (packaging stem–loop 2 (PSL2)) that mediates in vitro packaging and in vivo disease and is conserved across all known IAV isolates. A PSL2-targeting locked nucleic acid (LNA), administered 3 d after, or 14 d before, a lethal IAV inoculum provided 100% survival in mice, led to the development of strong immunity to rechallenge with a tenfold lethal inoculum, evaded attempts to select for resistance and retained full potency against neuraminidase inhibitor-resistant virus. Use of an analogous approach to target SARS-CoV-2, prophylactic administration of LNAs specific for highly conserved RNA structures in the viral genome, protected hamsters from efficient transmission of the SARS-CoV-2 USA_WA1/2020 variant. These findings highlight the potential applicability of this approach to any virus of interest via a process we term ‘programmable antivirals’, with implications for antiviral prophylaxis and post-exposure therapy