This work aimed to quantify the physical and mechanical behavior of three-dimensional microstructures in rocks under uniaxial compression. A high-precision in situ XCT (X-ray transmission computed tomography) technology was applied to investigating the behavior of mineral grains in sandstone: the movement, the rotation deformation, and the principal strains between fault zone and non-fault zone. The results indicate that after unloading, the shear strain of mineral grains is periodic in the radial direction, the strain of mineral grains in the fracture zone is about 30 times of the macro strai...