Rice straw is made up of hemicelluloses (19–27%), celluloses (32–47%), lignin (5–24%), and ash (13–20%), which are all agricultural waste. Rice straw ash is considered a green/eco-friendly source of silicon dioxide (SiO2). This study focuses on the synthesis and characterization of different mesoporous SiO2 nanostructures derived from rice straw waste material through controlling the pH of the extraction process for the first time. X-ray diffraction (XRD), Fourier transform infrared (FTIR), diffuse reflectance spectroscopy (DRS), field emission scanning electron microscope (FESEM), energy dispersive X-ray spectroscopy (EDX), high-resolution transmission electron microscope (HRTEM), zeta potential, and surface area analyzer were used to examine the produced materials. Amorphous silica nanostructures, S3 and S7, were produced at pH values of 3 and 7, respectively, according to XRD measurement, whereas higher pH causes the production of crystalline silica (S9). The pH of the extraction has a major effect on the morphology of the resultant nanosilica, as S3 has an irregular shape, S7 is made of distorted spherical particles, and S9 is composed of mixed fiber and spherical particle structures. For pollutant removal, greenly produced SiO2 nanostructures were used. The optimal mesoporous nanosilica (S9) demonstrated the highest surface roughness, the largest surface area (262.1 m2/g), the most negative zeta potential (− 20.2 mV), and the best dye adsorption capacity (71.4 mg/g).