Abstract. The chiral de Rham complex of Malikov, Schechtman, and Vaintrob, is a sheaf of differential graded vertex algebras that exists on any smooth manifold Z, and contains the ordinary de Rham complex at weight zero. Given a closed 3-form H on Z, we construct the twisted chiral de Rham differential D H , which coincides with the ordinary twisted differential in weight zero. We show that its cohomology vanishes in positive weight and coincides with the ordinary twisted cohomology in weight zero. As a consequence, we propose that in a background flux, Ramond-Ramond fields can be interpreted as D H -closed elements of the chiral de Rham complex. Given a T-dual pair of principal circle bundles Z, Z with fluxes H, H, we establish a degree-shifting linear isomorphism between a central quotient of the iR[t]-invariant chiral de Rham complexes of Z and Z. At weight zero, it restricts to the usual isomorphism of S 1 -invariant differential forms, and induces the usual isomorphism in twisted cohomology. This is interpreted as T-duality in type II string theory from a loop space perspective. A key ingredient in defining this isomorphism is the language of Courant algebroids, which clarifies the notion of functoriality of the chiral de Rham complex.