This paper presents a new method to realize excellent stability, high uniformity of microfoam by using a sandpack filled with glass beads, the micromorphology of microfoam were analyzed by microscope, and average bubble diameter and uniformity of microfoam were studied. The stability of xanthan gum-stabilized microfoam and common microfoam at the pore scale were also compared. The results showed that highly uniform microfoam from 10 to 100 μm in diameter with a variable coefficient less than 10% was successfully prepared. The bubble size of microfoam could be controlled by solution viscosity, gas and liquid flow rate, temperature and back pressure. The bubble size of microfoam decreased and become uniformed with the increase of solution viscosity, total flow rate, and back-pressure. The bubble size increased slightly and became non-uniformed with the increase of temperature, while concentration of foaming agent had little effect on bubble size when above 5000 mg/L. The xanthan gum in the solution increased viscosity and thickness of liquid membrane, so xanthan gum-stabilized Downloaded by [New York University] at 02:49 25 June 2015 2 microfoam maintained better stability within microconfined media than common microfoam under condition of 160 g/L salinity, 90 ℃ and 6 MPa back-pressure.