This paper describes photoelectrochemical dehydrogenative cyclization of 2-arylbenzoic acid and 2-arylbenzamide in a PEC cell consisting of a mesoporous WO 3 photoanode and Pt cathode. The cyclization reaction is effectively driven by this PEC system at room temperature with blue LED irradiation under external oxidant- and metal-free conditions, delivering a series of benzolactones and benzolactams in up to 95% isolated yields. Meanwhile, hydrogen is released as the only byproduct of this process.