In this study, the electrochromic titanium dioxide (TiO2) thin film has been deposited on the indium tin oxide/ glass (ITO/Glass) substrate by sol-gel method with spin coating technique. In order to optimize the electrochromic property of the TiO2 thin film, the influences of annealing temperatures (150°C - 650°C) for the TiO2 thin films have been studied. The electrochromic property of the TiO2 thin films was obtained in lithium (Li+) or hydrogen (H+) electrolyte solutions. The different transmittances (T%) of the TiO2 thin film could be obtained when the TiO2 thin film was immersed in different concentrations of H+ electrolyte solutions. Therefore, the pH concentration in solution can be defined by the transmittance. According to the results, the electrochromic TiO2 thin film can be developed to a pH sensor.