Based on the data of shale samples, including TOC, vitrinite reflectance and mineral composition, and through high-pressure mercury intrusion experiment, the pore structure parameters such as pore diameter, pore volume, specific surface area and porosity were obtained from the Taiyuan formation to the Shanxi formation in the Qinshui basin, and then fractal analysis was performed on the shale pore structure with a Sierpinski carpet model. The results show that the fractal mercury intrusion curve of the shale samples from the Taiyuan formation to the Shanxi formation can be divided into 3 sections such as AB, BC and CD. The pore diameter corresponding to the BC section is 21 to 6,035 nm. When performing fractal processing on a Sierpinski model, the pore structure of the BC section has the best characterization. In the range from 21 to 6,035 nm, the higher the clay mineral content, the stronger the heterogeneity and the more complicated of the pore structure. Pore volume, specific surface area and porosity are all negatively correlated with fractal dimension. Among them, pore volume and porosity have a good correlation with fractal dimension, and can be used as an indirect criterion for judging the complexity of pore structure.