Antiviral DNA cytosine deaminases APOBEC3A and APOBEC3B are major sources of mutations in cancer by catalyzing cytosine-to-uracil deamination. APOBEC3A preferentially targets singlestranded DNAs, with a noted affinity for DNA regions that adopt stem-loop secondary structures. However, the detailed substrate preferences of APOBEC3A and APOBEC3B have been fully established, and the specific influence of the DNA sequence on APOBEC3A APOBEC3B deaminase activity remains to be investigated. Here, we find that APOBEC3B selectively targets DNA stem-loop structures, and they are distinct from those subjected deamination by APOBEC3A. We develop Oligo-seq, a novel in vitro sequencing-based to identify specific sequence contexts promoting APOBEC3A and APOBEC3B activity. Through this approach, we demonstrate that APOBEC3A an APOBEC3B deaminase activity is strongly regulated by specific sequences surrounding the targeted cytosine. Moreover, we identify structural features of APOBEC3B and APOBEC3A responsible for their substrate preferences. Importantly, we determine that APOBEC3B-induced mutations in hairpin-forming sequences within tumor genomes differ from the DNA stem-loop sequences mutated by APOBEC3A. Together, our study provides evidence that APOBEC3A and APOBEC3B can generate mutation landscapes in cancer genomes, driven by their unique substrate selectivity.