All elementary particles in nature can be classified as fermions with half-integer spin and bosons with integer spin. Within quantum electrodynamics (QED), even though the spin of the Dirac particle is well defined, there exist open questions on the quantized description of spin of the gauge field particle—the photon. Using quantum field theory, we discover the quantum operators for the spin angular momentum (SAM) SM=(1/c)∫d3xπ×A and orbital angular momentum (OAM) LM=−(1/c)∫d3xπμx×∇Aμ of the photon, where πμ is the conjugate canonical momentum of the gauge field Aμ. We also reveal a perfect symmetry between the angular momentum commutation relations for Dirac fields and Maxwell fields. We derive the well-known OAM and SAM of classical electromagnetic fields from the above-defined quantum operators. Our work shows that the spin and OAM operators commute, which is important for simultaneously observing and separating the SAM and OAM. The correct commutation relations of orbital and spin angular momentum of the photon has applications in quantum optics, topological photonics as well as nanophotonics and can be extended in the future for the spin structure of nucleons.