IL-22 produced by innate lymphoid cells (ILCs) and CD4+ T cells plays an important role in host defense and mucosal homeostasis, thus it is important to investigate the mechanisms that regulate IL-22 production. We investigated the regulation IL-22 production by CD4+ T cells. Here we show that IL-21 triggers IL-22, but not IL-17 production by CD4+ T cells. STAT3, activated by IL-21, controls the epigenetic status of the il22 promoter and its interaction with the aryl hydrocarbon receptor (AhR). Moreover, IL-21 and AhR signaling in T cells control IL-22 production and the development of dextran sodium sulfate-induced colitis in ILC-deficient mice. Thus, we have identified IL-21 as an inducer of IL-22 production in CD4+ T cells in vitro and in vivo