Stretchable and tough hydrogels have been extensively used in tissue engineering scaffolds and flexible electronics. However, it is still a significant challenge to prepare hydrogels with both tensile strength and toughness by utilizing xylan, which is abundant in nature. Herein, we present a novel hydrogel of carboxymethyl xylan(CMX) graft gelatin (G) and doped with conductive hydroxyl carbon nanotubes (OCNT). CMX and G are combined through amide bonding as well as intermolecular hydrogen bonding to form a semi-interpenetrating hydrogel network. The hydrogel was further subjected to salting-out treatment, which induced the aggregation of the CMX-g-G molecular chain and the formation of chain bundles to toughen the hydrogel, the tensile strain, tensile stress, and toughness of CMX-g-G hydrogels were 1.547 MPa, 324 %, and 2.31 MJ m−3, respectively. In addition, OCNT was used as a conductive filler to impart electrical conductivity and further improve the mechanical properties of CMX-g-G/OCNT hydrogel, and a tensile strength of 1.62 MPa was obtained. Thus, the synthesized CMX-g-G/OCNT hydrogel can be used as a reliable and sensitive strain sensor for monitoring human activity. This study opens up new horizons for the preparation of xylan-based high-performance hydrogels.