Although ionic hydrogels have been developed recently for innovative wearable electronics, they necessitate high humidity to diffuse ions in water, which negatively impacts their performance in harsh conditions (e.g., high temperature and dry environments). In this study, a series of p- and n-type polymeric ionic gels (PIGs) with different ratios of ionic side chains are synthesized to allow only single-type ions to pass through them. The results demonstrate that our stretchable PIGs are transparent, thermally robust up to 125°C, and self-healing. Among the series of PIGs, p- and n-type PIGs with 75% ion moieties (P75 and N75) exhibit the optimum ionic conductivity (4.1×10− 4 and 2.7×10− 4 S cm-1) and ionic Seebeck coefficients (5.84, and − 4.18 mV K-1) under ambient conditions (25°C and RH of 30%), resulting in ZTi values of 1.87×10− 3 and 1.18×10− 3. Accordingly, P(([EMIM+][SPA])0.75-r-MA0.25) (P75) and P(([APTA][TFSI-])0.75-r-MA0.25) (N75) are used to achieve stretchable thermoelectric energy generators (TEGs) with stable operability under ambient conditions (RH of 30%), satisfying all of the requirements. TEGs with five pairs of p/n couples exhibit a thermovoltage of up to ~ 0.8 V.