Fabrication of electrochromic films with micro/nanostructures is one of the most feasible ways to improve their properties for high-performance electrochromic devices (ECDs). In this work, mesoporous TiO2 and NiO electrochromic films are prepared by sol-gel technique with an auxiliary solvent of F108 (PEO[Formula: see text]PPO[Formula: see text]PEO[Formula: see text]). By adjusting the content of F108 and heat treatment temperature, the transparent and uniform mesoporous films are successfully prepared. The TiO2 and NiO films are composed of inter-connected nanoparticles with a size of about 20 nm. The thicknesses of the films are about 300 nm and the mesoporous sizes are about 13 nm. The films have a short response time during the electrochromic process. When supplied with positive/negative voltages for 50 s, the coloring/bleaching times of TiO2 and NiO mesoporous films are 15/13 and 17/12 s, respectively. The ECD fabricated with TiO2 and NiO mesoporous films shows good electrochromic properties: short response time (14/19 s, for bleaching/coloring time), wide transmittance modulation range ([Formula: see text]37.21% at 540 nm), high coloration efficiency (CE) (100.6 cm2/C at 540 nm) and outstanding cycle stability (800 cycles). These are attributed to the mesoporous channels of films, which can increase reaction activity site, shorten ions transport path, and thus improve electrochromic reaction.