This study aims to explore the effects of Triptolide (TP) on the differentiation of Th17 cells in ankylosing spondylitis (AS). Peripheral blood mononuclear cells (PBMCs) collected from 10 patients with active AS patients were exposed to TP, GSK-J4 or vehicle. T lymphocyte subsets were analyzed using flow cytometry. ELISA was used to assess the level of IL-17. Western blot analysis and quantitative RT-PCR were used to measure the mRNA and protein levels of RORγt, JMJD3, EZH2, JAK2 and STAT3 in the JAK2/STAT3 signaling pathway. We observed a tendency toward a greater percentage of IL-17-positive CD4+ T cells in peripheral blood mononuclear cells (PBMCs) from patients with active AS than in those from healthy controls. Triptolide (TP) and GSK-J4 significantly reduced IL-17 expression. In cultured PBMCs from patients with active AS, 24 h of treatment with TP or GSK-J4 decreased the expression of RORγt ( < 0.05), JAK2 and STAT3 (JAK2: < 0.05; STAT3: < 0.05). Furthermore, both triptolide and GSK-J4 increased the level of histone 3 with Lys 27 trimethylation (H3K27me3) in patient-derived PBMCs. H3K27me3 enrichment was detected at the promoters of the RORc, STAT3 and IL-17 genes. Consistent with this finding, triptolide upregulated the EZH2 gene and downregulated the JMJD3 gene. Triptolide inhibits Th17 cell differentiation via H3K27me3 upregulation and orchestrates changes in histone-modifying enzymes, including JMJD3 and EZH2. These findings support the clinical efficacy of triptolide for AS and may provide clues for identifying molecular targets for the development of novel treatments.