Streptococcus pneumoniae (the pneumococcus) causes cytotoxicity and encapsulates within the lung parenchyma, leading to pneumococcal pneumonia. However, the underlying mechanisms remain unclear and likely involve multiple bacterial and host factors. We investigated the selection process of encapsulated pneumococci, a critical factor in lung damage during pneumococcal pneumonia. Our study revealed that pneumococci initially lack capsules but re-encapsulate upon reaching the alveoli. This process is driven by S. pneumoniae-derived hydrogen peroxide (Spn-H2O2), which oxidizes lung hemoglobin, leading to heme release and polymerized hemoglobin formation. Physiologically relevant levels of heme were found to promote the selection of encapsulated bacteria. Furthermore, encapsulation protects bacteria from intracellular heme toxicity, a defense absent in non-encapsulated strains. Ultrastructural analysis demonstrated interactions between hemoglobin and both encapsulated and non-encapsulated pneumococci in human sputum. These findings reveal a critical connection between oxidative stress-mediated lung damage and the selection of encapsulated pneumococci, suggesting potential therapeutic avenues by targeting these oxidative processes.