To mitigate the dependence on crude oil and reduce greenhouse gas emissions, research on alternative renewable energy sources has received worldwide attention for sustainable development. Salinity gradients between seawater and river water offer great potential for renewable energy production, which has been demonstrated by pressure retarded osmosis (PRO) and reverse electrodialysis (RED). However, challenges exist for both processes, such as insufficient energy efficiency, serious fouling and relatively high costs, etc. Alternative routes to achieve energy production from salty waters remain interesting to the community; one possible approach is by mechanical stress. Hydrogels are a group of materials that absorb water to different extents depending on salt concentration or mechanical stress. For example, charged hydrogels absorb water and swell when immersed in salt solutions, and change their volume when exposed to a different salt concentration, which can be utilized to produce energy if mechanical stress is applied. Compared with other processes, hydrogels may offer the advantages such as less fouling and ease of cleaning. In this study, we explored the potential of hydrogels for energy production by thermodynamic analysis and experimental demonstration. The thermodynamic energy efficiencies in ideal and practical processes have been found to be highly dependent on the charge properties and elastic modulus of hydrogels. The theoretical studies also provided implications on material design and process development; energy efficiency can be improved by magnitudes if materials are properly developed. In addition, experimental studies based on poly (styrene sulphonate) and poly (sulfobetainemethacrylate) hydrogels supported the theoretical analysis and demonstrated the possibility of energy production by hydrogels from salinity gradients.