Sol-gel method was successfully used for synthesis of ZnO nanoparticles doped with 10 % Mg or Cu. The structure, morphology and optical properties of the prepared nanoparticles were studied as a function of doping content. The synthesized ZnO:(Mg/Cu) samples were characterized using XRD, TEM, FTIR and UV-Vis spectroscopy techniques. The samples show hexagonal wurtzite structure, and the phase segregation takes place for Cu doping. Optical studies revealed that Mg doping increases the energy band gap while Cu incorporation results in decrease of the band gap. The antibacterial activities of the nanoparticles were tested against Escherichia coli (Gram negative bacteria) cultures. It was found that both pure and doped ZnO nanosuspensions show good antibacterial activity which increases with copper doping, and slightly decreases with adding Mg.