Mesoporous silica can be a dye adsorbent to overcome related environmental problems. In this report, the extraction of mesoporous SBA-15 from corncob ash (CCA) and rick husk ash (RHA) at different mass ratios between cetyltrimethyl ammonium bromide (CTAB) and pluronic (P123) were investigated. The crystalline structure, chemical composition, morphology, and surface area of the silica were characterized by small-angle X-ray scattering (SAXS), Fourier-transform infrared spectroscopy (FTIR), scanning electron microscopy (SEM), and Brunauer-Emmett-Teller (BET). Experimental results indicated that the mesoporous SBA-15 from both CCA and RHA could be obtained with P123/CTAB ratios of 3:1 and 1:1. The findings of this study showed that mesoporous silica produced from corn cobs with a surfactant mass ratio of 1:1 had the highest surface area and adsorption capacity. The resulting silica mesopore had a pore diameter of 6.24 nm and a surface area of 425.12 m2/g. As a result, the mesoporous silica effectively adsorbed methylene blue dye and partially adsorbed methylene orange dye with an adsorption capacity of 2.6 mg/g after 3 hours of the adsorption process. The highest adsorption capacity for mesoporous silica made from rice husk was 2.26 mg/g. This study proves that the mesoporous silica formed has a certain degree of selectivity and adsorbs cationic dyes better than anionic ones, indicating its potential for liquid chromatography applications.