Water energy harvesting technologies provide a promising approach for harnessing ubiquitous water for clean, renewable energy generation. However, existing systems often rely on mechanical water movement, liquid water supplementation, or high-humidity conditions, limiting their practical applications in fluctuating environments and wearables. Here, a self-gradient hydrogel-based moisture-induced electric generator (SHMEG) is reported, formed by the self-diffusion of pre-gel solution on carbon blacks loaded knitted fabric and a pair of sliver electrodes, which can maintain high performance and flexibility under various environments. The main driving source of SHMEG is the electric double-layer gradient formed at the hydrogel-carbon interface and the intrinsic properties of electrode. The SHMEG demonstrates a sustained voltage output of 0.75 V for 140 h and a current output of 15 mu A at approximate to 75% RH under room temperature (approximate to 25 degrees C). Benefitting from the high hygroscopicity, moisture retention, and temperature adaptability, SHMEG reliably delivers a stable electrical output of 0.5 V at 20% RH and 0.7 V at -10 degrees C. Moreover, SHMEG demonstrates versatility by powering small electronics and functioning as a strain sensor with up to 300% stretchability. This work represents a significant advance in moisture-induced energy harvesting, expanding its applicability to a broader range of environments and wearables.