AbstractMechanical properties of polymer‐derived ceramics are usually measured on samples pyrolyzed in inert atmosphere. Here, we report the hardness and elastic modulus of SiOC and SiCN pyrolyzed in both inert (Ar) and reactive (CO2) atmosphere. The external surface of the specimens exposed to the pyrolysis gas was characterized by Vickers microhardness measurements and infrared spectroscopy. The elastic modulus was evaluated by three‐point bending tests on thin (150‐200 µm) and dense specimens. Polished sections of the SiOC samples were prepared to study, by energy‐dispersive X‐ray spectroscopy (EDXS) and nanoindentation, how the elemental composition, hardness, and elastic modulus vary from the surface toward the bulk. For both compositions, pyrolysis in CO2leads to a strong decrease in the hardness and elastic modulus. The hardness of both the samples pyrolyzed in CO2approaches the typical value for fused silica, suggesting that CO2selectively breaks the Si–C and Si–N bonds and leads to the formation of a silica‐like network. EDXS and nanoindentation reveal that the modification induced by the CO2flow extends below the surface at least for a thickness of about 30 µm.