Accurate prediction of the affinity of ligand binding to nucleic acids represents a formidable challenge for current computational approaches. This limitation has hindered the use of computational methods to develop small-molecule drugs that modulate the activity of nucleic acids, including those associated with anticancer, antiviral, and antibacterial effects. In recent years, significant scientific and technological advances as well as easier access to compute resources have contributed to free-energy perturbation (FEP) becoming one of the most consistently reliable approaches for predicting relative binding affinities of ligands to proteins. Nevertheless, FEP's applicability to nucleic-acid targeting ligands has remained largely undetermined. In this work, we present a systematic assessment of the accuracy of FEP, as implemented in FEP+ software and facilitated by the OPLS4 force field, in predicting relative binding free energies of congeneric series of ligands interacting with a variety of DNA/RNA systems. The study encompassed more than 100 ligands exhibiting diverse binding modes, some partially exposed and others deeply buried. Using a consistent simulation protocol, more than half of the predictions are within 1 kcal/mol of the experimentally measured values. Across the data set, we report a combined average pairwise root-mean-square-error of <1.4 kcal/mol, which falls within one log unit of the experimentally measured dissociation constants. These results suggest that FEP+ has sufficient accuracy to guide the optimization of lead series in drug discovery programs targeting RNA and DNA.