Various standard methods have previously been used for the synthesis of nanoparticles that produce unhealthy waste. They are also considered unsafe and expensive methods. An alternative technology is needed to synthesize nanoparticles that consume less energy and are more environmentally friendly. In this research, a TiO2/ZnO nanocomposite has been synthesized, which was produced with efficient energy and no environmental pollution using an easy and fast method (electrochemical). Additionally, dye-sensitized solar cells (DSSCs) have been fabricated from TiO2/ZnO nanocomposite which was synthesized by a new green method and pigments (methylene blue as a chemical dye and chlorophyll as a natural dye). These DSSCs were characterized by their high ability to absorb ultraviolet energy, where the efficiency of energy conversion η of ITO-TiO2/ZnO were approximately 2.08, and 3.04% with chlorophyll and methylene blue, respectively, showing that η of ITO-TiO2/ZnO with methylene blue was the best.