The chemical compositions of essential oils extracted by n-hexane extract (HE), petroleum ether extract (PE), dichloromethane extract (DE), and hydrodistillation (HD) from Carthamus tinctorius L. (safflower) were analyzed by gas chromatography-mass spectrometry (GC-MS). A total of 86 compounds from four different extracts were identified, and the contents were 97.65%, 98.05%, 98.93%, and 99.68%, respectively. 6,10,14-Trimethyl-2-pentadecanone, hexadecanoic acid, methyl ester, hexadecanoic acid, 8,11-octadecadienoic acid, methyl ester, and 9,12,15-octadecatrien-1-ol were the major constituents of the extracts. The antidiabete activity was assayed in vitro by against protein tyrosine phosphatase 1B (PTP1B). The results showed that the HE exhibited the best in vitro inhibitory enzyme activity against PTP1B, which holds a good potential for treating diabetes and obesity.