Transition metal carbides are known for their exceptional thermal stability and mechanical properties, notably governed by the carbon content and the prevalent vacancies on the nonmetallic sublattice. We study this influence in detail by ab initio calculations and experiments for HfCy and TaCy thin films. Using HfC0.89 or TaC0.97 targets and non-reactive magnetron sputtering in Ar atmosphere, chemical compositions between HfC0.63 and HfC0.76 as well as TaC0.58 and TaC0.81 are achieved, for 500 C substrate temperature and varying the bias potential between floating and -100V, respectively. Increasing the substrate temperature to 700 C, leads to variations from TaC0.72 to TaC0.80. By co-sputtering a graphite target, stoichiometric TaC coatings are prepared. All HfCy films are single-phase face-centered cubic, whereas the TaCy films with C/Ta ratios below 0.75 also contain a small fraction of hexagonal Ta2C phase. The amount of vacancies on the carbon sublattice of these crystalline defected structures is therefore controlled through enhanced surface diffusion adjusted by deposition arameters. The columnar thin films, withstanding residual stresses up to 9 GPa, show exceptional mechanical properties. The highest hardness and indentation modulus among all the coatings studied is obtained for TaC0.78 with a hardness value of 43.70.65 GPa as well as indentation modulus of 553.920 GPa. Ab initio calculations predict a temperature driven stabilization of defected structures at high temperatures, with fewer vacancies on the C sublattice for Hf-C than Ta-C. The defected fcc-HfCy films are completely stable up to 2400 C and keep their initial composition. Phase modification occurs in the case of TaCy at 1625 C; depending on the mean initial carbon content and the stoichiometry distribution of the fcc-crystallites, further hexagonal Ta2C and stable fcc-grains with a defined y value are formed for TaCy thin films. The results obtained show concretely the promising possibility to utilize HfCy and TaCy as coating materials for applications in UHT environments. In general, it gives further insight in the development of transition metal carbides coatings using magnetron sputtering from compound targets and the inflence of vacancies on the superior thermomechanical properties. Designing properties by tuning the carbon and hence vacancy content could be proven both theoretically and experimentally, and is supposed to be a strong design tool in TMC thin films.