Textile sludge is a by-product produced during the wastewater treatment process in the textile printing and dyeing industry. Textile sludge is rich in heavy metal elements, which makes it a potential risk to the surrounding environment. This study designs a magnesium oxychloride cement (MOC) components to solidify harmful substances in textile sludge and studies the influence of textile sludge ash (TSA) on the mechanical properties and microstructure of MOC samples. The results indicated that adding 5 %–20 % TSA is beneficial for increasing the compressive strength of air-cured MOC paste and improving its water resistance. Meanwhile, the MOC sample shows volume expansion in 168 h, which is related to the further hydration of residual MgO. Incorporating 10 %–20 % TSA substantially increased the volume expansion ratio of the mixture compared to plain MOC sample. In addition, the porosity of TSA-modified MOC after water curing did not change significantly compared to the sample before water curing, while the pore structure of plain MOC after water curing significantly coarsened. This is mainly because TSA reacts with MOC and generates Mg-Al-Cl-Si-H and Mg-Cl-Si-H gels, consequently improving the water stability of MOC sample. At the nanoscale, the 3/5-phase crystal and unreacted MgO content in the 15 % TSA-modified MOC sample is relatively reduced by 7.79 % and 25 %, respectively, compared to the plain sample, but the 13 % gel phase is detected. In addition, the MOC component can effectively solidify heavy metal elements in textile sludge. For the leachate of 20 % TSA-modified MOC paste, the Ni element is not detected, and its solidifying effect on heavy elements such as Zn and Mn exceeded 99 %.