A poly(ionic liquid) probe material was prepared that is conductive, uniformly film-forming, and rich in I2 interaction sites by structural design. Green and pollution-free electrochemical detection of gaseous I2 was achieved based on the variation of redox peak currents, and the limit of detection was 1.44 nM. The differences in redox peak potentials were utilized for the specific detection of gaseous I2.