The formation of BiOX (X = Br and Cl) nanoparticles in a mesoporous silica (SBA-15) was found by the reaction of the infiltrated bismuth oxo species with HX vapor at room temperature. The cylindrical pores of SBA-15 led to the directional growth of BiOX nanorods and control of the particle diameter.