This paper presents the stem effect correction factors for the NE2561 and NE2571 ionization chambers calibrated in air and used at a depth in a phantom irradiated by medium-energy x-ray beams. The in air and in phantom stem effect correction factors were calculated as the ratios of the absorbed dose in the air cavity of an ionization chamber without and with a chamber stem. The 'global' stem correction factor was then calculated as the ratio of the in phantom correction factor to the in air correction factor. The calculations were carried out using the EGS4 (electron gamma shower version 4) Monte Carlo code system together with the use of a correlated sampling variance reduction technique. The results show that in general the chamber stem increases the chamber response in air but decreases it in phantom. For an NE2571 chamber the 'global' stem effect correction factor varies from 1.014 +/- 0.001 at 70 kV (2.9 mm A1, 0.1 mm Cu) to 1.005 +/- 0.001 at 300 kV (21.5 mm A1, 5.1 mm Cu) while for an NE2561 chamber it varies from 1.039 +/- 0.002 to 1.010 +/- 0.002 for the same kilovoltage and HVL values. In a 60Co beam the global stem correction is 1.001 +/- 0.001 for an NE2571 chamber and 1.003 +/- 0.001 for an NE2561 chamber. This is consistent with recent experimental results.