A compact 2K Gifford-McMahon (GM) cryocooler has been developed for cooling electronic devices, such as Superconducting Single Photo Detectors (SSPD). The heat exchangers, regenerators are optimized with the numerical simulation method developed for 4K GM cryocoolers. After optimizing, the cylinder length is reduced by 85mm compared with a commercial 0.1W 4K GM cryocooler. With no load on the second stage, a temperature of about 2.1K has been achieved. With 1W and 20 mW heat load, the temperature is 44.4K at the first stage and 2.23K at the second stage with an input power of about 1.1kW. And also, it is found that the temperature oscillation decreases as the average temperature decreases. A temperature oscillation of about ±20 mK has been achieved. The object of the project, target specification, and a summary of experiment results will also be introduced in this paper.