Magnetic molecularly imprinted polymers for hexamethylenetetramine were prepared. The characterization of the M-MIPs was studied. The adsorption isotherms and kinetics of the M-MIPs for HMT were investigated. A MISPE-GC-MS/MS method was established to analyze HMT in milk samples.