Nitrogen-containing mesoporous carbons with the use of colloidal silica spheres of (14 nm) and chitosan as a carbon precursor were obtained. A removal of such small template particles from carbonized silica–chitosan composite is difficult and HF with a minimum concentration of 15 wt% should be used. By varying the silica-to-chitosan ratio, the porous characteristic of products is controlled. The modification by ZnCl2 with a molar Zn-to-C (in chitosan mass) ratio of ‘6’ results in the development of microporosity; however it is accompanied by a significant reduction of mesopore volume (Vmes). The addition of ZnCl2 in a ratio of ‘5.25’ and pH adjustment to 5.8 increase the volumes of micropores, small mesopores, BET surface area to 1975 m2/g, and preserve Vmes of 4.15 cm3/g. The novelty of the presented strategy is the creation of microporosity in the hard-templated materials by incorporating ZnCl2 into the mixture of Ludox HS-40 template and chitosan precursor, as well as the investigation on how the pH of synthesis influences the final porosity. The pH of a silica–chitosan–zinc solution, equal to 3.9, provides some coordination of Zn2+ by –OH and –NH2 groups, whereas pH adjustment to 5.8 results in the precipitation of a new template—Zn(OH)2.