To understand the effects of an acidic environment on the internal structure of sandstone from the Yungang Grottoes, Datong, China, the physicochemical properties of fresh and weathered sandstone samples and their compressional wave (P-wave) velocities in response to different concentrations of H 2 SO 4 and HNO 3 solution were investigated. X-ray diffraction (XRD) and a scanning electron microscope equipped with energy dispersive X-ray spectrometer (SEM-EDX) were used to determine grain morphology and chemical composition. The results show that the sandstone, which mainly consists of silicon dioxide and calcium carbonate, became more complicated in composition after weathering. A nonmetallic ultrasonic detector was used to measure the P-wave velocities of sandstones in a natural state and soaked with ultrapure water and with H 2 SO 4 and HNO 3 at concentrations of 0.2 mol L −1 , 0.4 mol L −1 , and 0.8 mol L −1 , respectively. For the acid-treated groups, with increasing acidity, P-wave velocity decreased significantly, compressive strength decreased and effective porosity increased; these behaviours are different from those of the water-treat group, implying that the acid solutions damaged the microstructure of the sandstone. The results suggest that the deterioration risk of H 2 SO 4 and HNO 3 , or sulfates and nitrates converted from ambient SO 2 , NO x and PM 2.5 , on the stone relics in the Yungang Grottoes should be a cause for concern.