An electrofluorochromic (EFC) conjugated copolymer (PEFC) containing carbazole and benzothiadiazole (BTD) moieties is synthesized through Suzuki coupling followed by electrochemical polymerization, resulting in a nanoporous EFC polymer electrode. The electrode exhibits high sensitivity and selectivity in the EFC detection of cyanide anions (CN(-)) in largely aqueous electrolyte (67 vol % water) because electrochemical oxidation of PEFC leads to significant fluorescence quenching, and the presence of different concentrations (1 to 100 μM) of CN(-) in the electrolyte can weaken the oxidative quenching to substantially different extents. Although PEFC is hydrophobic in the neutral state, it is converted to radical cation/dication states upon oxidation, rendering the PEFC some hydrophilicity. Moreover, its nanoporous morphology provides a large surface area and short diffusion distance, facilitating the movement of CN(-) in the electrolyte into the PEFC film to interact with receptors. Density functional theory calculations show that the noncovalent interaction between electron-deficient BTD and nucleophilic CN(-) is energy favorable in the oxidized states in both aqueous and organic media, suggesting that the specific π(-)-π(+) interaction plays the main role in the CN(-) detection.