The development of potential toxic metal ion probes is of great significance in the field of environmental detection. Herein, two squaramide ligands (2a, 2b) were constructed by combining the characteristics of squaric acid and imine groups. 2a and 2b can recognize Cu2+ and Cd2+, with LOD of 1.26 × 10-8 M and 2.04 × 10-8 M, respectively, and have the advantages of fast response and wide pH range. The binding ratio and binding mode of the probe and the target ion were determined by Job’s plot, ESI-MS and 1H NMR.