SiCxNy:H thin films are obtained with the microwave plasma assisted chemical vapour deposition (MPACVD) method in the gas mixture H2/Ar/Hexamethyldisilazane. When very few amounts of nitrogen are added to the gas mixture, the film composition changes drastically from SiCx:H like films to SiNx:H like films, according to X‐rays Photoelectron Spectroscopy and Fourier Transform Infra‐Red Spectroscopy (FTIR) analysis. The refractive index (n) and Tauc's optical gap (Eg) are modified over a wide range of values (1.75 ≤ n ≤ 2.15 and 3.5 eV ≤ Eg ≤ 5 eV) with nitrogen addition to the feed gas leading to thin films optical constants close to those of SiC or Si3N4. Therefore, for the films obtained without nitrogen, SiC nanoparticles with a size of about 20 nm embedded in an amorphous SiCN:H matrix are synthesized, leading to nanocomposite films.