Antitumor necrosis factor-α (TNF-α) is used for treatment of severe cases of inflammatory bowel diseases (IBD), including Crohn's disease (CD) and ulcerative colitis (UC). However, one-third of the patients do not respond to the treatment. Genetic markers may predict individual response to anti-TNF therapy. Using a candidate gene approach, 39 mainly functional single nucleotide polymorphisms (SNPs) in 26 genes regulating inflammation were assessed in 738 prior anti-TNF-naive Danish patients with IBD. The results were analyzed using logistic regression (crude and adjusted for age, gender and smoking status). Nineteen functional polymorphisms that alter the NFκB-mediated inflammatory response (TLR2 (rs3804099, rs11938228, rs1816702, rs4696480), TLR4 (rs5030728, rs1554973), TLR9 (rs187084, rs352139), LY96 (MD-2) (rs11465996), CD14 (rs2569190), MAP3K14 (NIK) (rs7222094)), TNF-α signaling (TNFA (TNF-α) (rs361525), TNFRSF1A (TNFR1) (rs4149570), TNFAIP3(A20) (rs6927172)) and other cytokines regulated by NFκB (IL1B (rs4848306), IL1RN (rs4251961), IL6 (rs10499563), IL17A (rs2275913), IFNG (rs2430561)) were associated with response to anti-TNF therapy among patients with CD, UC or both CD and UC (P ⩽ 0.05). In conclusion, the results suggest that polymorphisms in genes involved in activating NFκB through the Toll-like receptor (TLR) pathways, genes regulating TNF-α signaling and cytokines regulated by NFκB are important predictors for the response to anti-TNF therapy among patients with IBD. Genetically strong TNF-mediated inflammatory response was associated with beneficial response. In addition, the cytokines IL-1β, IL-6 and IFN-γ may be potential targets for treating patients with IBD who do not respond to anti-TNF therapy. These findings should be examined in independent cohorts before these results are applied in a clinical setting.