In the current study, the UV-Vis spectrophotometer has been used for measuring the Diazinon. The extraction and preconcentration of Diazinon was done by the use of In Situ Solvent Formation Microextraction (ISFME) method, and the ionic liquids 1-Hexyl 3-methyl-imidazolium bromide [Hmim] [Br] and lithium (bis-trifluoromethylsulfonyl) -imide [Li (NTF2)] as the opposite ion. Different parameters effective on extraction such as the sample solvent pH, the amount of ionic liquid, the centrifuge duration, the amount of salt, and the amount of the opposite ion (NTF2-) were investigated at the two screening and response levels by the experiment designing software Statgraphic X64, in order to obtain the optimal conditions. Based on the obtained results, the highest rate of extraction was obtained as 95.41% in the pH of -11.77 for 1 ml solvent of 0.5 mg/Lit containing Diazinon, 120 mg of ionic liquid, 1 ml of the opposite ion with a concentration of 0.02 molar, and the duration of 5 minutes in the centrifuge. The limit of detection of this method is 0.42 mg/Lit based on the 3Sb equation and 0.69 mg/Lit based on the 3Sb/m equation. The relative standard deviation is 1.76% and the enrichment factor was calculated as 48.66.