Heterocyclic moiety was mentioned to present diverse biological activities such as inhibitors of protein glycation, antibacterial, antifungal, anticancer, antidepressant, anti-inflammatory, antituberculosis, antioxidant, and as antiviral agents, in addition to other biological activities; therefore, many medicines containing heterocyclic moiety have been observed. Due to the pharmacological importance of heterocyclic derivatives, the present work comes as attempt to synthesis of heterocyclic compound involved (tetrazole and pyrazole rings) by series of steps starting from pyrimidin-2-amine, which reacted with 2-chloroacetyl chloride gave compound (1) [2-chloro-N-(pyrimidin-2-yl) acetamide], then the refl ex reaction of the compound (1) with the hydrazine hydrate in ethanol led to compound (2) [2-hydrazinyl-N-(pyrimidin-2-yl)acetamide], the last one reacted with acetyl acetone to form pyrazole ring compound (3) [2-(3,5-dimethyl-1H-pyrazol-1-yl)-N-(pyrimidin-2-yl)acetamide]. In other line another pyrazole derivative was prepared by diazotization of pyrimidin-2-amine with NaNO2/HCl to azo derivative compound (4), which is reacted with acetyl acetone gave compound (5) [3-(2-(pyrimidin-2-yl)hydrazono)pentane-2,4-dione] to react with hydrazine gave pyrazole moiety compound (6) [(2-((1H-pyrazol-4-yl)diazenyl)pyrimidine]. Pyrimidin-2-amine was reacted with 4-hydroxybenzaldehyde in ethanol and glacial acetic acid gave Schiff base compound (7) , which reacted with sodium azide in dioxane to form tetrazole ring compound (8) [4-(1-(pyrimidin-2-yl)-4,5-dihydro-1H-tetrazol-5-yl)phenol]. The spectroscopic techniques were used to confi rmed the chemical structures are FTIR, 1H-NMR. The biological study of pyrazole and tetrazole derivative was evaluated as anti-bacterial against gram-negative (Klebsiella pneumoniae), gram-positive (Enterococcus faecalis) and as anti-fungal against the Candida trichomonas and Candida dubliniensis in concentration 25, 75, 50, and 100 mg/mL. It was found that pyrazole and tetrazole derivative have biological activity against the bacteria and fungi where the tetrazole ring has biological eff ect more than pyrazole ring.