Herein, we successfully synthesized high-quality Hf-ZnO thin films with various Hf contents (0, 3, 6, 9, 12, and 15 at. %), which showed both superhydrophilic (6% Hf-ZnO) and ultrahydrophobic (15% Hf-ZnO) wetting behavior. Different characterization methods were opted to recognize the structural (XRD, SEM, AFM) and defect properties (XPS) of the pristine and doped materials, to understand the mechanisms underlying the tuning of wetting behavior (contact angle). Hafnium doping plays a noteworthy role in tuning the morphology of the ZnO nanostructures, roughness of the material surface, generation of defects, Lewis acid-base interactions, and wettability properties. We achieved a superhydrophilic surface with 6% Hf-ZnO owing to a smooth surface, less basicity, and maximum concentration of oxygen vacancies, and also an ultrahydrophobic surface with 15% Hf-ZnO because of the rough surface, high basicity, and minimum concentration of oxygen vacancies. The as prepared Hf-ZnO samples showed stable performance (stability, wearability, weatherability, and antifouling) under real-life conditions marking them multifunctional and biosafe material to be effectively used in solar and building's window. A wetting mechanism was established to relate the wetting behavior of the samples to oxygen vacancies (active sites for water dissociation: resulted due to charge mismatch of host cation (Zn2+) by the doped cation (Hf4+)), roughness (smooth surface (Wenzel) with minimum Rrms (0.588) portraying hydrophilic property and rough caltropic surface (Cassie-Baxter) with maximum Rrms (2.522) portraying hydrophobic property), basicity (H2O: Lewis Base; ZnO: Lewis acid; HfO2: Lewis base) and morphology (tube-like structure (0-6% Hf-ZnO) and caltrop-like structure (12-15% Hf-ZnO)).