  We develop a theory of T-duality for transitive Courant algebroids. We show
that T-duality between transitive Courant algebroids E\rightarrow M and
\tilde{E}\rightarrow \tilde{M} induces a map between the spaces of sections of
the corresponding canonical weighted spinor bundles \mathbb{S}_{E} and
\mathbb{S}_{\tilde{E}} intertwining the canonical Dirac generating operators.
The map is shown to induce an isomorphism between the spaces of invariant
spinors, compatible with an isomorphism between the spaces of invariant
sections of the Courant algebroids. The notion of invariance is defined after
lifting the vertical parallelisms of the underlying torus bundles M\rightarrow
B and \tilde{M} \rightarrow B to the Courant algebroids and their spinor
bundles. We prove a general existence result for T-duals under assumptions
generalizing the cohomological integrality conditions for T-duality in the
exact case. Specializing our construction, we find that the T-dual of an exact
or a heterotic Courant algebroid is again exact or heterotic, respectively.
