Mercury is a toxic metal that can be found everywhere - it is used in many products of our daily life and mercury contamination usually cannot be detected by any of the five human senses. Continuous exposure to mercury has severe implications neurologically, gastrointestinally and with respect to renal organ systems. This study was conducted to develop a portable and easy-to-use chemosensor with 1- anilino-3-phenyliminourea (AP) for detecting Hg2+ ions in aqueous system. The sensitivity of AP in acting as a chemosensor was optimized based on solvent/co-solvent ratio and pH. The result showed that AP has a highly sensitivity against Hg2+ in DMSO/citrate buffer (8/2, v/v, pH = 4.0). The LOD of AP against Hg2+ ions was calculated at 69.02 μM. The stoichiometric ratio of AP-Hg2+ was 1:1 as determined by the Job’s plot analysis. COSMO-RS results show that DMSO and AP formed stronger hydrogen bonds due to the peaks of both appearing at greater positive and negative sigma profile values in the H-bond acceptor and H-bond donor regions, respectively. Molecular electrostatic potential, Fukui function and electronic transition were successfully performed using the DFT method to characterize and support the experimental data in predicting the interaction that occurs between AP and Hg2+ ions. The calculated HOMO–LUMO energy gaps of AP and Ap–Hg2+ were 3.72 eV and 1.95 eV, respectively. The result aligned with the UV–vis analysis where a redshift occurred after formation of the complex. Using naked eye observation, the developed test strip using the AP chemosensor also demonstrated a colour change in recognizing Hg2+ ions in aqueous media.