We say that an algebra $\Lambda$ over a commutative noetherian ring $R$ is Calabi-Yau of dimension $d$ ($d$-CY) if the shift functor $[d]$ gives a Serre functor on the bounded derived category of the finite length $\Lambda$-modules. We show that when $R$ is $d$-dimensional local Gorenstein the $d$-CY algebras are exactly the symmetric $R$-orders of global dimension $d$. We give a complete description of all tilting modules of projective dimension at most one for 2-CY algebras, and show that they are in bijection with elements of affine Weyl groups, preserving various natural partial orders. We show that there is a close connection between tilting theory for 3-CY algebras and the Fomin-Zelevinsky mutation of quivers (or matrices). We prove a conjecture of Van den Bergh on derived equivalence of noncommutative crepant resolutions.