Polyethylene glycol (PEG) was employed as pore-forming agent to prepare TiO2 nanoporous film based on spin-coating a TiO2 nanoparticle mixed paste on fluorine doped tin oxide (FTO) glass. The electrochromic and optical properties of the obtained TiO2 film were investigated by cyclic voltammetry (CV), chronoamperometry (CA) and UV–Vis spectrophotometer. The results show that the PEG in the mixed paste endows the TiO2 film with well-developed porous structure and improves the uniformity of the TiO2 film, which are helpful for the rapid intercalation and extraction of lithium ions within the TiO2 film and the strengthening of the diffuse reflection of visible light in the TiO2 film. As a result, the TiO2 film derived from the mixed paste with PEG displays higher electrochemical activity and more excellent electrochromic performances compared with the TiO2 film derived from the mixed paste without PEG. The switching times of coloration/bleaching are respectively 10.16/5.65 and 12.77/6.13 s for the TiO2 films with PEG and without PEG. The maximum value of the optical contrast of the TiO2 film with PEG is 21.2% while that of the optical contrast of the TiO2 film without PEG is 14.9%. Furthermore, the TiO2 film with PEG has better stability of the colored state than the TiO2 film without PEG.