© 2020 Elsevier LtdIn this study, a simple and quick ionic liquid- based ultrasonic-assisted microextraction (IL-UA-ME) procedure has been improved for extraction of melamine in dairy products followed by UV–VIS spectrometry. For the analysis of stability and reactivity of melamine and its some metal complexes, quantum chemical parameters like frontier orbital energy-HOMO-LUMO energy gap, hardness and softness were calculated using computational chemistry tools. The results regarding to stability analysis made considering density functional theory showed that theoretical data obtained are compatible with experimentally obtained results, and Fe-melamine complex is more stable compared to others. Under optimum conditions, the linearity was in the range of 0.05–400 ng mL−1 with detection limit of 0.015 ng mL−1. Following the validation studies, recovery and relative standard deviation were obtained in range of 92.5–104.3% and 1.4–2.1%, respectively. The first research article in which experimental and theoretical studies are used together for the determination of melamine in dairy products.