Some aspects of this disclosure provide compositions, methods, systems, and kits for controlling the activity and/or improving the specificity of RNA-programmable endonucleases, such as Cas9. For example, provided are guide RNAs (gRNAs) that are engineered to exist in an “on” or “off” state, which control the binding and hence cleavage activity of RNA-programmable endonucleases. Some aspects of this disclosure provide gRNAs that modulate the activity of an RNA-programmable endonuclease based on the presence or absence of an extended DNA (xDNA).