Two new hydroxyl-containing polyimides (PIs) with excellent comprehensive performances were designed and synthesized. After PIs react with fluoride ion (F−), the resulting polyimide-fluoride complexes (PI-1 ·F and PI-2 ·F) are exploited as ratiometric and colorimetric sensors for detecting trace water in DMSO/DMF with high sensitivity. Both sensors PI-1 ·F and PI-2 ·F exhibit a good naked-eye visual detection as well as an excellent linear relationship between the UV– vis absorbance ratio and the low water content in DMSO/DMF, which constitutes a quantitative method for determining water content in DMSO/DMF. The limits of detection (LOD) of sensor PI-1 ·F for water in DMSO and DMF are as low as 0.0035% and 0.0031% (v/v), respectively. The sensor PI-2 ·F shows the higher sensitivity for water detection with extremely low detection limits of 0.00084% and 0.0015% in DMSO and DMF, respectively. Furthermore, PI films have been directly used for the visual sensing of water in acetonitrile, acetone and ethanol, which provides an effective way for fabricating high-performance film-based water sensor devices. Image 1 • Two hydroxyl-containing polyimides are successfully synthesized. • Polyimide-fluoride complexes are applied for detecting trace water in organic solvents. • The sensors show high sensitivity toward a trace amount of water in DMSO and DMF. • The sensors exhibit a good naked-eye visual water detection. • PI films are directly used for visual detection of water in organic solvents. [ABSTRACT FROM AUTHOR]