The field of the globular cluster M12 (NGC 6218) was monitored between 1995 and 2009 in a search for variable stars. $BV$ light curves were obtained for 36 periodic or likely periodic variables. Thirty-four of these are new detections. Among the latter we identified 20 proper-motion members of the cluster: six detached or semi-detached eclipsing binaries, five contact binaries, five SX~Phe pulsators, and three yellow stragglers. Two of the eclipsing binaries are located in the turnoff region, one on the lower main sequence and the remaining three among the blue stragglers. Two contact systems are blue stragglers, and the remaining three reside in the turnoff region. In the blue straggler region a total of 103 objects were found, of which 42 are proper motion members of M12, and another four are field stars. Forty-five of the remaining objects are located within two core radii from the center of the cluster, and as such they are likely genuine blue stragglers. We also report the discoveries of a radial color gradient of M12, and the shortest period among contact systems in globular clusters in general