Summary Channelrhodopsins harvest the light and convert photons to the cellular ion flow. The ion selectivity and activation mechanism at the atomic level remains unknown. Here we describe cryo-EM structures for H. catenoides kalium channelrhodopsin ( Hc KCR1), its paralog, sodium selective channelrhodopsin ( Hc CCR), an open state of Hc KCR1 (C110T), the voltage-dependent inwardly rectifier (D116N) and higher potassium selective channelrhodopsin ( B1 ChR2) from Bilabrum sp , illuminating the ion selectivity and activation mechanism. Briefly, the hourglass shaped lumen is occupied by the stepwise dehydrated potassium in both intracellular and extracellular side. The aromatic amino acids likely function as partial dehydrated potassium filter in the extracellular lumen, and intracellular dehydrated ion occupying layer chooses the right size of dehydrated ion, thus specifying ion selectivity and the higher dehydration capacity, the higher potassium selectivity. Furthermore, structural comparison of Hc KCR1 and C110T suggested that the conformational changes of retinal triggers the extracellular side of TM6 extension as well as the retinal interaction residues motion, which then leads to ion flow. Our results not only uncovered the ion selectivity mechanism of potassium or sodium selective channelrhodopsins, but also elucidated their activation mechanism. It may provide a framework for designing next generation optogenetic tools.