A series of imidazole derivatives were synthesized from two-component condensation reaction of phenylgloxal monohydrate with guanylhydrazone. They were characterized by spectroscopic and analytical techniques. The in vitro anticancer evaluation of these compounds was done on human breast cancer (MCF-7) and human liver cancer (HepG2) cell lines using the MTT assay method. Most of the newly synthesized compounds displayed cytotoxic activity against these cancerous cells. In fact, compounds 3a, 3e, and 3 h exhibited more cytotoxic activities than the positive control drugs, fluro-5, and irinocam, against the MCF-7 cell line. Almost all the compounds, except for three, 3b, 3d, and 3f, gave more cytotoxic results than cisplatin. Therefore, these compounds could be considered for further development as anticancer drug candidates.