Context. The infrared (IR) excess of classical Cepheids is seldom studied and poorly understood despite observational evidence and the potential for its contribution to induce systematics on the period-luminosity (PL) relation used in the calibration of the extragalactic distance scale. Aims. This study aims to understand the physical origin of the IR excess found in the spectral energy distribution (SED) of 5 Cepheids: RS Pup (P = 41.46d), ζ Gem (P = 10.15d), η Aql (P = 7.18d), V Cen (P = 5.49d) and SU Cyg (P = 3.85d). Methods. A time series of atmospheric models along the pulsation cycle were fitted to a compilation of data, including optical and near-IR photometry, Spitzer spectra (secured at a specific phase), interferometric angular diameters, effective temperature estimates, and radial velocity measurements. Herschel images in two bands were also analyzed qualitatively. In this fitting process, based on the SPIPS algorithm, a residual was found in the SED, whatever the pulsation phase, and for wavelengths larger than about 1.2 μm, which corresponds to the so-determined infrared excess of Cepheids. This IR excess was then corrected from interstellar medium absorption in order to infer the presence (or absence) of dust shells and was, ultimately, used in order to fit a model for a shell of ionized gas. Results. For all Cepheids, we find a continuum IR excess increasing up to approximately −0.1 magnitudes at 30 μm, which cannot be explained by a hot or cold dust model of CircumStellar Environment (CSE). However, a weak but significant dust emission at 9.7 μm is found for ζ Gem, η Aql and RS Pup, while clear interstellar clouds are seen in the Herschel images for V Cen and RS Pup. We show, for the first time, that the IR excess of Cepheids can be explained by free–free emission from a thin shell of ionized gas, with a thickness of ≃15% of the star radius, a mass of 10−9−10−7M⊙ and a temperature ranging between 3500 and 4500 K. Conclusions. The presence of a thin shell of ionized gas around Cepheids must be tested with interferometers operating in the visible or mid-IR, or using radio telescopes. The impact of such CSEs of ionized gas on the PL relation of Cepheids also calls for further investigation.