We study the classifying space of a twisted loop group $L_{\sigma}G$ where $G$ is a compact Lie group and $\sigma$ is an automorphism of $G$ of finite order modulo inner automorphisms. Equivalently, we study the $\sigma$-twisted adjoint action of $G$ on itself. We derive a formula for the cohomology ring $H^*(BL_{\sigma}G)$ and explicitly carry out the calculation for all automorphisms of simple Lie groups. More generally, we derive a formula for the equivariant cohomology of compact Lie group actions with constant rank stabilizers.