Many extensions of the Standard Model include an extra gauge boson, whose couplings to fermions are constrained by the requirement that anomalies cancel. We find a general solution to the resulting diophantine equations in the plausible case where the chiral fermion content is that of the Standard Model plus 3 right-handed neutrinos.