CRISPR (clustered regularly interspaced short palindromic repeat) systems have been broadly adopted for basic science, biotechnology, and gene and cell therapy. In some cases, these bacterial nucleases have demonstrated off-target activity. This creates a potential hazard for therapeutic applications and could confound results in biological research. Therefore, improving the precision of these nucleases is of broad interest. Here we show that engineering a hairpin secondary structure onto the spacer region of single guide RNAs (hp-sgRNAs) can increase specificity by several orders of magnitude when combined with various CRISPR effectors. We first demonstrate that designed hp-sgRNAs can tune the activity of a transactivator based on Cas9 from Streptococcus pyogenes (SpCas9). We then show that hp-sgRNAs increase the specificity of gene editing using five different Cas9 or Cas12a variants. Our results demonstrate that RNA secondary structure is a fundamental parameter that can tune the activity of diverse CRISPR systems.