A group of substituted formazine derivatives was prepared through several steps where the first step was the preparation of compound (1) by reacting chloroacetyl chloride with 2-aminopyrimidine, and the second step was the reaction of compound (1) with hydrazine hydrate to obtain the derivative (2) and in the third step was prepared Schiff’s base (3) by reaction of derivative (2) with para-dimethyl benzaldehyde and then a number of formazine derivatives were synthesized by reaction of derivative (3) with a number of substituted aromatic amines. The newly prepared derivatives are distinguished by their melting points (1H-nuclear magnetic resonance (1H-NMR), fourier transform infrared spectroscopy (FTIR)) spectra. The biological activity of the prepared derivatives was studied on two types of bacteria that cause urinary tract and measuring the diameter of the inhibition zone against the growth of these bacteria.