Pollution caused by the release of toxic heavy metals into the environment by industrial and farming processes has been regarded as a major problem worldwide. This has attracted a great deal of attention into restoration and remediation. Mercury is classi ed as a toxic heavy metal which has posed signi cant challenges to public and environmental health. To date, conventional methods for mercury detection rely on expensive, destructive, complex, and highly specialized methods. Evidently, there is a need to develop systems capable of easily identifying and quantifying mercury within the environment. In this way, organic-based colorimetric chemosensors are gaining increasing popularity due to their high sensitivity, selectivity, cost-effectiveness, ease of design, naked-eye, and on-site detection ability. The formation of coumarin-azo derivative AD1 was carried out by a conventional diazotization reaction with coumarinamine 1c and N,N-dimethylaniline. Sensor AD1 displayed remarkable visual colour change upon mercury addition with appreciable selectivity and sensitivity. The detection limit was calculated as 0.24 µM.Additionally, the reversible nature of AD1 allowed for the construction of an IMPLICATION type logic gate and Molecular Keypad Lock. Chemosensor AD1 displayed further sensing applications in real-world water samples and towards on-site assay methods. Herein, we describe a coumarin-derived chemosensor bearing an azo (N = N) functionality for the colorimetric and quantitative determination of Hg 2+ in organic and aqueous media.