<i>Context. <i/>Diffusion of atoms can be important during quiescent phases of stellar evolution. Particularly in the very thin inert envelopes of subdwarf B stars, diffusive movements will considerably change the envelope structure and the surface abundances on a short timescale. Also, the subdwarfs will inherit the effects of diffusion in their direct progenitors, namely giants near the tip of the red giant branch. This will influence the global evolution and the pulsational properties of subdwarf B stars.<i>Aims. <i/>We investigate the impact of gravitational settling, thermal diffusion and concentration diffusion on the evolution and pulsations of subdwarf B stars. Although radiative levitation is not explicitly calculated, we evaluate its effect by approximating the resulting iron accumulation in the driving region. This allows us to study the excitation of the pulsation modes, albeit in a parametric fashion. Our diffusive stellar models are compared with models evolved without diffusion. <i>Methods. <i/>We use a detailed stellar evolution code to solve simultaneously the equations of stellar structure and evolution, including the composition changes due to diffusion. The diffusion calculations are performed for a multicomponent fluid using diffusion coefficients derived from a screened Coulomb potential. We constructed subdwarf B models with a mass of 0.465 from a 1 and 3 zero-age main sequence progenitor. The low mass star ignited helium in an energetic flash, while the intermediate mass star started helium fusion gently. For each progenitor type we computed series with and without atomic diffusion.<i>Results. <i/>Atomic diffusion in red giants causes the helium core mass at the onset of helium ignition to be larger. We find an increase of 0.0015 for the 1 model and 0.0036 for the 3 model. The effects on the red giant surface abundances are small after the first dredge up. The evolutionary tracks of the diffusive subdwarf B models are shifted to lower surface gravities and effective temperatures due to outward diffusion of hydrogen. This affects both the frequencies of the excited modes and the overall frequency spectrum. Especially the structure and pulsations of the post-non-degenerate sdB star are drastically altered, proving that atomic diffusion cannot be ignored in these stars. Sinking of metals could to some extent increase the gravities and temperatures due to the associated decrease in the stellar opacity. However, this effect should be limited as it is counteracted by radiative levitation.