Perturbative and nonperturbative results are presented on the renormalization constants of the quark field and the vector, axial-vector, pseudoscalar, scalar, and tensor currents. The perturbative computation, carried out at one-loop level and up to second order in the lattice spacing, is performed for a fermion action, which includes the clover term and the twisted mass parameter yielding results that are applicable for unimproved Wilson fermions, as well as for improved clover and twisted mass fermions. We consider ten variants of the Symanzik improved gauge action corresponding to ten different values of the plaquette coefficients. Nonperturbative results are obtained using the twisted mass Wilson fermion formulation employing two degenerate dynamical quarks and the tree-level Symanzik improved gluon action. The simulations are performed for pion masses in the range of 480-260 MeV and at three values of the lattice spacing, a, corresponding to β=3.9, 4.05, 4.20. For each renormalization factor computed nonperturbatively we subtract its perturbative O(a2) terms so that we eliminate part of the cutoff artifacts. The renormalization constants are converted to MS̄ at a scale of μ=2GeV. The perturbative results depend on a large number of parameters and are made easily accessible to the reader by including them in the distribution package of this paper, as a Mathematica input file.