Streptococcus pneumoniae isolates typically express one of over 90 immunologically distinguishable polysaccharide capsules (serotypes), which can be classified into "serogroups" based on cross-reactivity with certain antibodies. Pneumococci can alter their serotype through recombinations affecting the capsule polysaccharide synthesis (cps) locus. Twenty such "serotype switching" events were fully characterised using a collection of 616 whole genome sequences from systematic surveys of pneumococcal carriage. Eleven of these were within-serogroup switches, representing a highly significant (p < 0.0001) enrichment based on the observed serotype distribution. Whereas the recombinations resulting in between-serogroup switches all spanned the entire cps locus, some of those that caused within-serogroup switches did not. However, higher rates of within-serogroup switching could not be fully explained by either more frequent, shorter recombinations, nor by genetic linkage to genes involved in β-lactam resistance. This suggested the observed pattern was a consequence of selection for preserving serogroup. Phenotyping of strains constructed to express different serotypes in common genetic backgrounds was used to test whether genotypes were physiologically adapted to particular serogroups. These data were consistent with epistatic interactions between the cps locus and the rest of the genome that were specific to serotype, but not serogroup, meaning they were unlikely to account for the observed distribution of capsule types. Exclusion of these genetic and physiological hypotheses suggested future work should focus on alternative mechanisms, such as host immunity spanning multiple serotypes within the same serogroup, which might explain the observed pattern.