Linear and nonlinear optical properties of silicon suboxide SiOx films deposited by plasma-enhanced chemical-vapor deposition have been studied for different Si excesses up to 24 at. %. The layers have been fully characterized with respect to their atomic composition and the structure of the Si precipitates. Linear refractive index and extinction coefficient have been determined in the whole visible range, enabling to estimate the optical bandgap as a function of the Si nanocrystal size. Nonlinear optical properties have been evaluated by the z-scan technique for two different excitations: at 0.80 eV in the nanosecond regime and at 1.50 eV in the femtosecond regime. Under nanosecond excitation conditions, the nonlinear process is ruled by thermal effects, showing large values of both nonlinear refractive index (n2∼-10-8 cm2/W) and nonlinear absorption coefficient (β∼10-6 cm/W). Under femtosecond excitation conditions, a smaller nonlinear refractive index is found (n2∼10-12 cm2/W), typical of nonlinearities arising from electronic response. The contribution per nanocrystal to the electronic third-order nonlinear susceptibility increases as the size of the Si nanoparticles is reduced, due to the appearance of electronic transitions between discrete levels induced by quantum confinement.