Spatiotemporal regulation of viral capsid assembly ensures the selection of the viral genome for encapsidation. The porcine circovirus 2 is the smallest autonomously replicating pathogenic virus, yet how PCV2 capsid assembly is regulated to occur within the nucleus remains unknown. We report that pure PCV2 capsid proteins, in the absence of nucleic acids, require acidic conditions to assemble into empty capsids in vitro. By employing constant pH replica exchange molecular dynamics, we unveil the atomistic mechanism of pH-dependency for capsid assembly. The results show that an appropriate protonation configuration for a cluster of acidic amino acids is necessary to appropriately position the GH-loop for driving the capsid assembly. We demonstrate that assembly is prohibited at neutral pH because deprotonation of these residues results in their electrostatic repulsion, shifting the GH-loop to a position incompatible with capsid assembly. We propose that encapsulation of nucleic acids overcomes this repulsion to suitably position the GH-loop. Our findings provide the first atomic resolution mechanism of capsid assembly regulation. These findings are useful for the development of therapeutics that inhibit PCV2 self-assembly.