Coronavirus nsp15 is an endoribonuclease that limits the accumulation of viral dsRNA in cytosol and plays a crucial role in the evasion of host immunity. Here, we show that Co2+ or Ni2+ potently activates nsp15 of human and animal coronaviruses, including SARS-CoV-2, SARS-CoV, MERS-CoV, HCoV-229E, MHV-A59, and PEDV. Whereas Zn2+ strongly inhibits nsp15 of these coronaviruses. Cryo-EM structures of the Co2+-bound SARS-CoV-2 nsp15/dsRNA complexes reveal that Co2+ binds to the nsp15 active site and is coordinated by three catalytic residues H234, H249, K289, and the 2\' hydroxyl of the flipped base from dsRNA, suggesting that Co2+ stabilizes the catalytic core and increases substrate binding. Although our data indicated that Ni2+ and Zn2+ bind to the same site as Co2+, Zn2+ lacks the catalytic capability and inhibits nsp15. These findings reveal that divalent cations govern coronavirus nsp15\' s activity and provide basis for new therapeutic strategies.