Ocular toxoplasmosis (OT) is characterised by intraocular inflammation due to Toxoplasma gondii infection. Studies have found that interleukin 17 (IL‐17) plays a central role in the pathology of OT. However, nucleotide variability in IL17 and interleukin 17 receptor (IL17R) genes has not been characterised in OT. As cytokine gene polymorphisms may influence the expression of these molecules, the aim of this study was to verify whether IL17A (rs2275913), IL17F (rs763780), IL17RA (rs4819554) and IL17RC (rs708567) polymorphisms are associated with OT in a Brazilian population. This study enrolled 214 patients seropositive for T. gondii (110 with OT and 104 without) and 107 controls. Polymorphisms were identified by PCR‐restriction fragment length polymorphism analysis, validated by DNA sequencing with chi‐square and multivariate analyses being used to assess possible associations between polymorphisms and OT. Logistic regression under the dominant model revealed a protection factor against OT of the C mutant allele of the IL17F (rs763780) polymorphism. The T/C‐C/C genotypes were significantly more common in patients without OT compared to those with OT (p value = 0.0066) and controls (p value = 0.014). Findings from this study suggest that the IL17F polymorphism may have an influence in the immunopathology of OT in Brazilian individuals.