Zernike polynomials and their associated coefficients are commonly used to quantify the wavefront aberrations of the eye. When the aberrations of different eyes, pupil sizes, or corrections are compared or averaged, it is important that the Zernike coefficients have been calculated for the correct size, position, orientation, and shape of the pupil. We present the first complete theory to transform Zernike coefficients analytically with regard to concentric scaling, translation of pupil center, and rotation. The transformations are described both for circular and elliptical pupils. The algorithm has been implemented in MATLAB, for which the code is given in an appendix.