  The quantization of the electrical charge in the electrodynamics and of the
hypercharge in the standard model are imposed in the theory based not on
theoretical arguments but on the experimental observations. In this paper we
propose a quantum consistency condition in a theory where Ward identities are
respected that requires the quantization of the charge within the framework of
the theory without external impositions. This refers to the renormalization
conditions in the background gauge field method such that to ensure a correct
mathematical correspondence between the bare partition function and the
renormalized one. Applied to the standard model of elementary particles our
criterion together with the anomaly cancellation condition leads to the correct
hypercharge assignment of all standard model fermions.
