We study the trace and chiral anomalies of Weyl fermions in a nonabelian gauge background in four dimensions. Using a Pauli-Villars regularization we identify the trace anomaly, proving that it can be cast in a gauge invariant form, even in the presence of the non-abelian chiral anomaly, that we rederive to check the consistency of our methods. In particular, we find that the trace anomaly does not contain any parity-odd topological contribution, whose presence has been debated in the recent literature.