In the present study, the adsorption of cyanogen chloride (CNCl) and hydrogen cyanide (HCN) molecules on some important nanocages including (AlN) 12 , (AlP) 12 , (BN) 12 , (BeO) 12 , (CSi) 12 , (MgO) 12 and C 24 were investigated by density functional theory (DFT) calculations. The calculated adsorption energies ( E ads ) showed that Al 12 N 12 has the highest value of E ads compared to the other nanocages in the interaction with HCN and CNCl. The calculations showed that the interactions of HCN and CNCl from their N atoms with the nanocages are stronger than the interaction from their H and Cl atoms. In the most stable complexes, HCN and CNCl are in localy interactions from their N atoms with Al, B, Be, Mg and Si atoms of the nanocages. The quantum theory of atoms in molecules (QTAIM) was used to determine the nature of the interaction between the HCN and ClCN, and selected nanocages. The potential of the nanocages for sensing the CNCl and HC was investigated by calculating both the UV absorption spectra of complexes and their density of states (DOS). The calculations showed that five nanocages including (AlN)12, (AlP)12, (BeO)12, (BN)12 and (CSi) 12 have potential for the detection of cyanogen chloride and hydrogen cyanide molecules.