© 2022 John Wiley & Sons Ltd.In this study, ZnO nanostructures with different morphologies were produced by varying anodizing parameters (time and voltage), and the photocatalytic activities of these structures were examined. ZnO nanostructures were fabricated through different voltage and duration consisting of nine samples with KHCO3 solution as an electrolyte. The produced ZnO nanostructures were investigated by using X-ray diffraction (XRD), scanning electron microscopy, X-ray photoelectron spectroscopy, and UV–vis spectrophotometer. It was found that the morphology of ZnO was formed as nanosponge, nanoflower, nanowire, heterogeneous structures. ZnO nanostructures were identified by matching XRD peaks due to the ICDD database. Experiments on photocatalytic degradation of methylene blue demonstrated the photocatalytic activity of ZnO samples. The best photocatalytic performance of the samples was observed by S1 sample, which was anodized for 30 min in 0.05 M of KHCO3 electrolyte at 20 V, after 420 min exposure of the UV–vis light source with the degradation rate of 87.3%. Such ZnO nanostructures exhibit unique properties and have high potential for wastewater treatment.