Microbial metabolites, such as short-chain fatty acids (SCFAs), are highly produced in the intestine and potentially regulate the immune system. We studied the function of SCFAs in the regulation of T-cell differentiation into effector and regulatory T cells. We report that SCFAs can directly promote T-cell differentiation into T cells producing interleukin-17 (IL-17), interferon-γ, and/or IL-10 depending on cytokine milieu. This effect of SCFAs on T cells is independent of GPR41 or GPR43, but dependent on direct histone deacetylase (HDAC) inhibitor activity. Inhibition of HDACs in T cells by SCFAs increased the acetylation of p70 S6 kinase and phosphorylation rS6, regulating the mTOR pathway required for generation of Th17 (T helper type 17), Th1, and IL-10(+) T cells. Acetate (C2) administration enhanced the induction of Th1 and Th17 cells during Citrobacter rodentium infection, but decreased anti-CD3-induced inflammation in an IL-10-dependent manner. Our results indicate that SCFAs promote T-cell differentiation into both effector and regulatory T cells to promote either immunity or immune tolerance depending on immunological milieu.