By using the DFT and TD-DFT method, the potential of B12N12 nanocage to adsorb and detect of cyanogen fluoride (FCN) as a toxic gas molecule in the present of 1H+, 2H+, and 3H+ ions field and static electric field (SEF) were investigated at the WB97XD level of theory at the 6-31G (d, p) basis set. The structural and electrical parameters, adsorption energy, quantum descriptor, quantum theory of atom in the molecule (QTAIM), reduced density gradient (RDG), nonlinear optical properties (NLO), UV–Visible transitions, and thermodynamic parameters were calculated and results were analyzed. The adsorption energy ( Eads), Enthalpy (ΔH) and Gibbs free energy (ΔG) values for all adsorption models were negative, and adsorption of FCN on the B12N12 nanocage was exothermic in the thermodynamic approach. The bandgap energy of all adsorption models is in the range of 7.60–11.08 eV, and with increasing the H+ ions functionalized and SEF, the bandgap energy of FCN/B12N12 complex decreased significantly from the pristine model, and so the conductivity and sensitivity of nanocluster increased. The QTAIM, ELF, LOL, and RDG results demonstrated that the attractive interaction between FCN and B12N12 in all models was a strong covalent bond. The NLO results revealed that the 3H+ functionalized B12N12 in presence of FCN was optically active. On the other hand, the calculated results demonstrated that the B12N12 nanocluster in the presence of 700 × 10−3 a.u electrostatic field ( SEF0.70-z) and functionalizing 3H+ ions was a good strategy for adsorbing and making a sensitive sensor for FCN toxic gas.