New substituted pyrimidine and triazolopyrimidine derivatives were synthesized. The N 3 -glycosides of both heterocyclic systems and acyclic oxygenated alkyl derivatives were also prepared. The anticancer activity against human prostatic adenocarcinoma (PC3), human colorectal carcinoma (HCT116) and human breast adenocarcinoma (MCF7) cell lines in addition to their effect on human normal retinal pigmented epithelial cell line (RPE1) was studied. Furthermore, the docking studies revealed good binding affinities for compounds 7, 8, 10 and 12. The results showed the effect of N 3 -substitution in the pyrimidine ring on the activity of synthesized compounds.