In this work, an optical sensor for detection of ascorbic acid is described. The sensor is fabricated by casting and spin-coating silica sol-gel doped with 2,6-dichlorophenol indophenol on the glass plates. The sols are in turn obtained by acidic hydrolysis of various precursors such as tetraethoxysilane, triethoxymethylsilane and triethoxyoctylsilane in the presence of 2,6-dichlorophenol indophenol as dopant. Prepared sols then were coated on glass plates to form sol-gel films. UV-Vis spectrophotometric properties of 2,6-dichlorophenol indophenol doped in sol-gel films were studied and compared with in solution. At the optimum conditions the response of film to ascorbic acid is fast and linear in 0.07 – 3.34 mmol L-1 range. Detection limit and relative standard deviation of presented sensor for determination ascorbic acid were 0.05 mmol L-1 and 1.32 %, respectively.