A green and practical method for the synthesis of C-3 halogenated benzothiophenes and benzofurans from 2-alkynylthioanisoles or 2-alkynylanisoles and potassium halide was developed under transition-metal-and oxidant-free conditions, employing an assembled electrochemistry continuous-flow system. The carbon and platinum plates were used as the anode and cathode, respectively; KI or KBr not only served as a halogen source but also as an electrolyte. Moderate to good yields of C-3 halogenated benzothiophenes and benzofuran derivatives were obtained under constant current. Notably, the halogen could also be restored at the cathode to obtain C-3 dehalogenated benzothiophenes and benzofurans in high selectivity by adjusting the current and flow rate of the continuous-flow system. Moreover, this reaction could be easily scaled up with good efficiency in the continuousflow system, which presents major advantages over reactions in a traditional batch.