Ta3N5 photoelectrodes were synthesized with varying chemical compositions to understand the effects of different defect types and concentrations on bulk and surface properties. In brief, we sputter-deposited TaOx, TaNx, and Ta thin film precursors, which were subsequently annealed at high temperatures in flowing NH3, and are denoted as Ta3N5(O), Ta3N5(N), and Ta3N5(Ta), respectively. For all precursors, homogeneous polycrystalline Ta3N5 photoelectrodes are formed with a thickness of ~75 ± 20 nm and increasing surface roughness from Ta3N5(O), to Ta3N5(N), to Ta3N5(Ta) (Supplementary Fig. 1). Previously, we reported that all three types of photoelectrodes generate similar photocurrent densities and onset potentials1. However, Ta3N5(N) and Ta3N5(Ta) were shown to degrade immediately upon exposure to illumination under ferrocyanide oxidation conditions. In general, the stability has been found to strongly depend on the type of hole scavenger11,25 and can be enhanced by surface modification and catalyst integration8,26,27,28,29. Together, these studies reveal the impact of surface and interface properties on PEC characteristics. To understand the underlying reason for this behavior, we now investigate the differences between surface and bulk properties, as well as the specific impacts of synthesis and post-synthetic processing on defining them. To this end, we combine multiple techniques with different probing depths (Supplementary Table 1), with surface-sensitive measurements typically probing the near-surface region within ~5–10 nm. In addition, we note that the transition between surface and bulk properties is not sharply defined and can vary between the three films due to differences in precursor composition, defect distributions, and resulting structural inhomogeneities.

Here, differences between the bulk and surface chemical composition of the differently synthesized films were elucidated by ERDA and XPS, respectively. In the bulk, Ta3N5(Ta) is characterized by an almost ideal stoichiometry, Ta3N5(O) by increased oxygen content, and Ta3N5(N) by increased nitrogen content (Supplementary Table 2). The comparison between XPS and ERDA consistently reveals that the oxygen content is approximately three times higher at the surface than in the bulk across all three films. In detail, we observe decreasing O/Ta ratios for Ta3N5(O) to Ta3N5(N) to Ta3N5(Ta), while the N/Ta ratio simultaneously increases (Supplementary Table 3). As a result, the composition of Ta3N5(Ta) is closest to the ideal stoichiometry of Ta3N5, while Ta3N5(O) is characterized by increased oxygen content and Ta3N5(N) by slightly increased nitrogen content. Furthermore, formation of an oxygen-rich surface layer is also apparent in the oxygen depth profiles obtained by ERDA (Supplementary Fig. 2a), which reveal a gradually decreasing concentration towards the bulk, in agreement with previous literature1,30,31. For ERDA measurements, it is important to note that the gradual increase in element concentrations in the first ~10 nm arises from the limited depth resolution of the detection system, broadening the depth profile. Therefore, we only use ERDA to reveal general trends in the distribution of oxygen and nitrogen near the surface and within the bulk of the films. We observe an increase of near-surface oxygen content relative to bulk, which is most pronounced for Ta3N5(O) with the highest oxygen content, and is reduced for Ta3N5(N) and Ta3N5(Ta), which contain lower oxygen concentrations. In contrast, the nitrogen content exhibits a more homogeneous distribution throughout the bulk. Overall, these results show a pronounced difference between surface and bulk compositions, with these variations depending sensitively on the synthesis route.

To link the observed compositional changes with the surface and bulk structure of the Ta3N5 thin films, we next performed GIWAXS measurements as a function of different incident X-ray angles, which correspond to different penetration depths. For a penetration depth of 38 nm (Fig. 1a–c), all three films exhibit distinct and well-defined reflections, confirming the formation of polycrystalline Ta3N5 in the bulk. In addition, these GIWAXS data show progressively greater broadening of the reflections from Ta3N5(Ta) to Ta3N5(N) to Ta3N5(O), as well as an increasing diffuse scattering background, indicating increasing disorder between these films. Complementary bulk-sensitive grazing incidence X-ray diffraction (GI-XRD) data confirm these observations and additionally reveal shifts in the peak positions (Supplementary Fig. 3)1,3 corresponding to small changes in the lattice parameter. In particular, we observe a decrease in the b-axis lattice parameter for increasing oxygen content, while the a- and c-axes only show minor variations between samples. Overall, these findings agree with prior studies that have attributed enhanced lattice disorder and reduced b-axis lattice parameters to increased oxygen incorporation in the bulk1,9,30,32,33,34.

Fig. 1: Bulk and surface structures of Ta3N5 thin films as a function of the different precursors.Fig. 1: Bulk and surface structures of Ta3N5 thin films as a function of the different precursors.

GIWAXS spectra of Ta3N5(O), Ta3N5(N), and Ta3N5(Ta) using a penetration depth of a–c 38 nm and d–f 3 nm, respectively. g–i Corresponding GIWAXS depth-dependent integrated scattering intensity maps. qr corresponds to the in-plane scattering vector component and qz to the out-of-plane component. Source data for g-i are provided as a Source data file.

For GIWAXS measurements performed at an incident angle corresponding to a penetration depth of 3 nm, Ta3N5(Ta) still exhibits a clear polycrystalline structure with only minor differences between the surface and bulk. In contrast, the diffraction rings from surface-sensitive GIWAXS measurements are broadened for Ta3N5(N). Even more strikingly, Ta3N5(O) is characterized by the formation of an amorphous surface layer (Fig. 1d). These differences are further highlighted by incident angle-dependent GIWAXS maps (Fig. 1g–i), which reveal the structural evolution from the surface to the bulk of each film. While Ta3N5(Ta) and Ta3N5(N) exhibit rather crystalline surface layers, the structural differences between surface and bulk are more significant for the case of Ta3N5(O). In detail, Ta3N5(O) is characterized by a significantly thicker and more disordered surface layer, extending to greater than 10 nm below the surface, whereas the corresponding surface layer on Ta3N5(N) is limited to approximately 5 nm.

Complementary to GIWAXS, we investigated the near-surface structure of the three photoelectrodes by cross-sectional scanning transmission electron microscopy (STEM). High-angle annular dark field (HAADF) STEM images (Fig. 2) reveal an amorphous surface layer on both Ta3N5(O) and Ta3N5(N), with a thickness exceeding 10 nm for Ta3N5(O) but approximately 5 nm on Ta3N5(N). In contrast, Ta3N5(Ta) exhibits a crystalline surface. In this regard, we note that a previous study on Ta3N5 nanotubes, synthesized by electrochemical anodization of Ta foil and NH3 annealing, showed the formation of a crystalline surface structure by TEM4. While the present results on films derived from pure Ta are in agreement with this finding, we observe significantly different characteristics for the films synthesized from TaNx and TaOx precursors. The formation of an amorphous surface layer is likely impacted by different synthesis methods, precursor compositions, and conversion conditions, as well as geometric constraints during ammonolysis. For example, the conversion of TaOx into Ta3N5 is associated with an increase in mass density, leading to a volume contraction, whereas the conversion of TaNx and Ta into Ta3N5 is characterized by a reduction in mass density, leading to a volume expansion. In addition, thin films are laterally constrained by the substrate and conversion proceeds from the surface, whereas nanostructures, such as nanotubes, have significantly larger gas/solid interface areas from which the transformation can proceed and open internal volumes that can better accommodate density changes. In addition to such factors, comparison of these structural changes with the chemical compositions of the films indicates that increased surface disorder is correlated with increasing oxygen content in the precursor films. Such differences are more evident at the surface compared to the bulk, where the different thin films only exhibit subtle structural variations (Fig. 1). These results provide the demonstration of both structural and chemical deviations between surface and bulk properties in Ta3N5 as a function of different defect properties and chemical compositions. As discussed below, the increased disorder and higher oxygen contents at the surface can also impact the defect properties and electronic characteristics in both regions.

Fig. 2: Near-surface structures of Ta3N5 thin films as a function of the different precursors.Fig. 2: Near-surface structures of Ta3N5 thin films as a function of the different precursors.

Cross-sectional HAADF STEM images of a–c Ta3N5(O), d Ta3N5(N), and e Ta3N5(Ta). b, c Are zoom-in images of the marked areas in (a). The black areas at the top of the cross-sections correspond to an evaporated carbon layer. The gray areas correspond to Ta3N5 and show the transition from the surface (top) towards the bulk (down).

To gain deeper insight into the impact of these different structural properties and chemical compositions on the (opto)electronic properties of Ta3N5, we next performed N K-edge XAS using both bulk-sensitive TFY and surface-sensitive TEY (Fig. 3) detection modes. In agreement with previous studies1,4, the TFY spectra show similar features and absorption onsets, independent of the synthesis pathway, with the exception of the sharp absorption peak located at ~401 eV. This feature can be attributed to dinitrogen incorporated in the lattice1,4, and is especially prominent for Ta3N5(N). This finding is consistent with prior observations that the addition of nitrogen to sputter gas mixtures can result in the incorporation of dinitrogen35 that remains present even after NH3 annealing36. Interestingly, the dinitrogen absorption was significantly weaker in the surface-sensitive TEY spectra (Fig. 3b), indicating that these species are primarily entrapped in the bulk lattice rather than the surface region. Finally, we note that there is no significant change between the different samples in the O K-edge at 532 eV in the bulk (Fig. 3c, d)37. In contrast, the surface is characterized by increasing absorption strength at 532 eV from Ta3N5(Ta) to Ta3N5(N) to Ta3N5(O), in agreement with the XPS results above.

Fig. 3: XAS data of the N and O K-edges of Ta3N5 thin films as a function of the different precursors.Fig. 3: XAS data of the N and O K-edges of Ta3N5 thin films as a function of the different precursors.

Normalized N and O K-edge in a, c bulk-sensitive total fluorescence yield (TFY) and b, d surface-sensitive total electron yield (TEY) mode showing the bulk and surface properties of Ta3N5(O), Ta3N5(N), and Ta3N5(Ta), respectively. Source data are provided as a Source data file.

To gain further insights into defect formation and concentrations at the surface and in the bulk, we conducted steady-state confocal PL spectroscopy at low temperatures (10 K). An excitation power of 2 mW (corresponding to ~1.2 × 105 W cm−2) was selected to ensure saturation of emission from defect states for all thin films (Supplementary Fig. 4). As shown in Fig. 4, the depth-dependent optical emission spectra for Ta3N5(O), Ta3N5(N), and Ta3N5(Ta) reveal two peaks for all films, with one more pronounced in the bulk and the other at the surface, independent of the specific film composition.

Fig. 4: Depth-dependent photoluminescence of Ta3N5 thin films as a function of the different precursors.Fig. 4: Depth-dependent photoluminescence of Ta3N5 thin films as a function of the different precursors.

a–c PL intensity map at 10 K as a function of depth (z) of Ta3N5(O), Ta3N5(N), and Ta3N5(Ta) excited with a wavelength of 532 nm and a power of 2 mW. d–f PL spectra extracted from a to c for surface and bulk regions, indicated by gray and black dotted lines. Source data are provided as a Source data file.

For optical excitation near surfaces of the films, a broad emission band between 600 nm and 800 nm is observed, indicating the presence of deep-level defect states that have previously been assigned to vN and reduced Ta states2,17. We note that prior drive-level capacitance profiling measurements also demonstrated that deep-level defect densities are over an order of magnitude higher at the surface than in the bulk of Ta3N538. Comparing the sub-bandgap emission intensities among the three films suggests that the defect concentration decreases progressively from Ta3N5(Ta) to Ta3N5(N) to Ta3N5(O). Interestingly, among the three films, Ta3N5(Ta) displays the strongest emission from deep-level defects at the surface, despite the fact that it is characterized by the highest crystallinity and lowest oxygen content. In contrast, Ta3N5(O) forms an amorphous surface layer, but with comparatively weak PL from surface defects. In agreement with a previous study1, our findings suggest that oxygen incorporation results in greater structural disorder but can also beneficially passivate deep-level defects.

In contrast to the more surface-sensitive measurements discussed above, the PL spectrum from the bulk is dominated by a distinct emission peak at 580 nm, which is consistent with the indirect bandgap of 2.2 eV and has been previously assigned to the band-to-band transition of Ta3N52,3,14. Near the surface, the strong contribution from deep-levels leads to competitive trapping and recombination, suppressing band-edge and increasing sub-bandgap emission.

In a recent study, we investigated the PEC properties of all three Ta3N5 films in 1 M potassium phosphate (KPi) buffer (pH 12.3) with and without the addition of 0.1 M K4Fe(CN)6 as a hole scavenger in the dark and under illumination (AM 1.5 G, 100 mW cm−2)1. Under illumination and in the presence of ferrocyanide, the photocurrent onset potential increased from Ta3N5(N) to Ta3N5(Ta) to Ta3N5(O), while the photocurrent density at 1.23 V vs. reversible hydrogen electrode (VRHE) was similar for all photoelectrodes. In contrast, chronoamperometry (CA) measurements revealed rapid degradation of Ta3N5(N) and Ta3N5(Ta) during the first 5 min of the experiment in the presence of a hole scavenger, whereas Ta3N5(O) showed stable operation. Additionally, we observed that all photoelectrodes undergo rapid degradation under water oxidation conditions without a hole scavenger present. The PEC characteristics measured in the present work agree with these prior findings (Fig. 4), and together indicated that they strongly differ between the three photoelectrodes, depending on their material and defect properties, as well as (photo)electrochemical environments.

While the previous studies described above focused on understanding the bulk material properties, it is important to recognize that the surfaces of photoanodes play a critical role in determining the characteristics of solid-liquid junctions. Indeed, we find that PEC performance is directly correlated with the surface properties obtained by PL, GIWAXS, and XPS. In particular, Ta3N5(N) and Ta3N5(Ta) surfaces possess lower oxygen contents and improved crystallinity, but also higher deep-level defect concentrations, resulting in rapid degradation. Specifically, larger deep-level defect concentrations near the surfaces of these films result in an unfavorable kinetic competition between interfacial charge injection and trapping-mediated self-oxidation reactions. In contrast, the Ta3N5(O) surface is characterized by an amorphous surface layer with reduced deep-level defect concentrations, enabling kinetic stabilization of the photoelectrode. These results highlight the importance of understanding defect-mediated recombination processes and approaches to mitigate them for the rational development of interfaces that enable efficient interfacial charge transport and transfer, facilitating high efficiency and long-term stability.

To improve the PEC performance characteristics and stabilities of Ta3N5, we performed a 1 min post-growth chemical treatment with HF (5%) with the aim of modifying the surface properties by removing the disordered surface layer and/or passivating defects. While HF treatment was already reported to improve the PEC performance of Ta3N528, the impact on the surface characteristics remains unknown. Here, we include a similar surface treatment to investigate the critical impact on structure, chemical composition, and disorder at the surface, but also to link these surface properties to the PEC characteristics after HF treatment. To this end, linear sweep voltammetry (LSV) was performed in 1 M KPi with 0.1 M K4Fe(CN)6 under chopped illumination, both before and after the HF treatment (Fig. 5). In agreement with previous reports28,39, an enhancement of the photocurrent density and reduction of the onset potential is observed for all films following this HF treatment, while the surface morphology remains similar after HF treatment (Supplementary Fig. 5). Most prominently for Ta3N5(Ta), the photocurrent transients observed during the LSV are reduced after the treatment, indicating reduced interfacial charge trapping1,40,41,42,43,44. The moderate PEC performance observed in this study reflects the deliberate use of model thin films designed to enable comparative mechanistic insights from the different precursor-based synthesis routes. In particular, the film thickness is significantly lower than the ~800 nm typically required to achieve maximum PEC efficiency, and a non-ideal Si back contact was utilized45. These choices were made to ensure homogeneous nitridation, enable precise spectroscopic and compositional analysis, and avoid elemental contributions from the support, even though they reduce the light harvesting efficiency and introduce additional back-contact resistances.

Fig. 5: Photoelectrochemical performance characteristics before and after HF surface treatment of Ta3N5 thin films as a function of the different precursors.Fig. 5: Photoelectrochemical performance characteristics before and after HF surface treatment of Ta3N5 thin films as a function of the different precursors.

Linear sweep voltammetry and chronoamperometry measurements for 10 min at 1.23 VRHE of a, d Ta3N5(O), b, e Ta3N5(N), and c, f Ta3N5(Ta) thin films under chopped illumination in 1 M KPi (pH 12.3) in the presence of 0.1 M K4Fe(CN)6 as a hole scavenger, before and after the 1 min HF treatment using a three electrode setup. No iR correction was applied to the potentials. Source data are provided as a Source data file.

Despite the removal of the disordered surface layer following HF etching, differences in PEC performance persist, arising from differences in bulk defect properties associated with the use of three different precursors. As previously reported1, Ta3N5(N) and Ta3N5(Ta) exhibit comparatively high concentrations of deep-level defects, whereas the higher oxygen content in Ta3N5(O) facilitates passivation of such states. While deep-level defects lead to rapid photocarrier trapping and recombination, limiting PEC performance, shallow oxygen donors can enhance the electronic conductivity and enable kinetic stabilization of the interface1. Consistent with these differences in bulk defect concentrations, Ta3N5(O) exhibits improved PEC performance and stability compared to Ta3N5(N) and Ta3N5(Ta) following HF etching (Fig. 5 and Supplementary Fig. 6). Before HF exposure, only Ta3N5(O) exhibited stable PEC performance characteristics, while both Ta3N5(N) and Ta3N5(Ta) suffered from rapid photocurrent decay (Fig. 5). After HF treatment, all three films show improved durability, which could be indicative of more similar surface and interface properties. Even after 10 h of operation, Ta3N5(O) still shows stable operation, while a slow decay in the photocurrent density is observed for Ta3N5(N) and Ta3N5(Ta). Consequently, enhanced PEC performance and stability are observed for ferrocyanide oxidation even for Ta3N5(N) and Ta3N5(Ta) films with high deep-level defect concentrations.

Complementary XPS measurements after 10 h of stability testing reveal changes in the N/Ta and O(530 eV)/Ta ratios (Supplementary Table 4, Supplementary Fig. 7), indicating slight surface oxidation following sustained ferrocyanide oxidation by the HF-treated photoelectrodes. Surface oxidation is mostly pronounced for Ta3N5(N) and Ta3N5(Ta) compared to Ta3N5(O). Comparing XPS spectra of Ta3N5 photoelectrodes without HF treatment after a 1 h durability test from our previous study1 with HF-treated Ta3N5 photoelectrodes after the 10 h durability test from this study indicates that higher N/Ta ratios are maintained for HF-treated films despite the 10x longer testing duration. Overall, this indicates that HF treatment reduces surface oxidation of Ta3N5 photoelectrodes. Accordingly, we show that kinetic stabilization of Ta3N5 can be achieved independent of the exact defect properties by optimizing and tuning the surface, independent of the bulk.

To better understand how structural and chemical changes induced by the HF treatment influence the PEC performance characteristics, both the bulk and surface structures were again probed using depth-dependent GIWAXS measurements (penetration depths of 38 nm and 3 nm, respectively). As shown in Fig. 6, while only minimal changes are observed in the bulk, a pronounced sharpening of the near-surface diffraction features is observed after HF treatment of all three photoelectrodes, indicating improved crystallinity at the surface. This effect is most significant for Ta3N5(O), where distinct reflections emerge after HF treatment compared to the amorphous layer observed for the as-grown material (Fig. 1). In addition, Ta3N5(N) and Ta3N5(Ta) show enhanced peak intensities and reduced FWHM at a penetration depth of 3 nm. For all films, the improved crystallinity at the surface after HF treatment is also evident in the integrated intensity maps as a function of incident angle (Fig. 6g–i), indicating reduced thicknesses of the surface layers. To confirm the removal of the surface layer, complementary cross-sectional STEM measurements were conducted on Ta3N5(O) after HF treatment (Supplementary Fig. 8). Compared to as grown Ta3N5(O), the measurements confirm that the amorphous layer is significantly reduced after HF etching and the near-surface crystallinity is improved.

Fig. 6: Bulk and surface structures of Ta3N5 thin films as a function of the different precursors after HF surface treatment.Fig. 6: Bulk and surface structures of Ta3N5 thin films as a function of the different precursors after HF surface treatment.

GIWAXS spectra of Ta3N5(O), Ta3N5(N), and Ta3N5(Ta) measured using a penetration depth of a–c 38 nm and d–f 3 nm, respectively. g–i GIWAXS depth-dependent integrated intensity maps. qr corresponds to the in-plane scattering vector component and qz to the out-of-plane component. Source data for (g–i) are provided as a Source data file.

Additionally, XPS analysis of the O 1s, N 1s, and Ta 4f core levels of all three Ta3N5 films provides additional insight into the chemical surface modifications induced by HF treatments (Supplementary Figs. 911). For Ta 4f and N 1s, we considered the contribution of all formed species, while for O 1s, only the peak at ~530 eV was considered (O(530 eV)), corresponding to Ta-O bonds and thus to oxygen incorporated in Ta3N5. For Ta3N5(O), a reduction in the O(530 eV)/Ta ratio and a slight increase in the total N/Ta ratio are observed. Interestingly, after HF treatment, Ta3N5(N) and Ta3N5(Ta) possess similar O(530 eV)/Ta ratios within the detection limit of our system, while the N/Ta ratio is slightly reduced, reaching values that are similar to that of Ta3N5(O) (Supplementary Table 5). The subtle changes in the surfaces of these two films are consistent with their more ordered, thinner surface layers directly after synthesis, while the similarity in N content agrees with their more similar surface structures following the HF treatment. Furthermore, we do not observe significant changes in the core level binding energies, which agrees with previous XPS observations from Ta3N5 surfaces treated with a mixed etchant (HF/HNO3/H2O = 1:2:7)2.

Furthermore, we analyzed the F 1s and O 1s to better understand the surface properties of the different Ta3N5 thin films. In the F 1 s spectra (Supplementary Figs. 12 and 13), we observed the presence of fluoride ions only after HF treatment for all films. In the O 1s spectra, hydroxyl groups and exposed regions of silicon terminated by sub-oxides have overlapping signals at ~532 eV. To understand the presence of hydroxyl groups on the surface, the contributions need to be deconvoluted (Supplementary Table 6). The remnant photoemission intensity after subtracting the silicon oxide contribution suggests that hydroxyl groups are also present at the surface after HF treatment. Furthermore, we analyzed the chemical composition after PEC testing for 10 h and immersion for 1 min in 1 M KPi with hole scavenger (Supplementary Figs. 12 and 13), which shows the fast disappearance of the F 1 s contribution on the surface, while the stability is still improved. These findings indicate that fluoride ion absorption on the surface is not the main reason for the observed stabilization.

To understand how the termination impacts the surface properties, we performed contact angle measurements with deionized water before and after HF treatments (Supplementary Fig. 14). Directly after nitridation, the photoelectrodes are relatively hydrophobic, with contact angles ranging from 80° to 100° across different defect types. These findings agree with a previous report on oxide-to-nitride converted Ta3N546. After HF treatment, the contact angles are significantly reduced by ~40° for all three thin films, indicating enhanced surface hydrophilicity. Before and after HF treatment, Ta3N5(N) and Ta3N5(Ta) exhibit rather similar contact angles, whereas Ta3N5(O) exhibits slightly higher values. In general, it has been shown that the surface hydrophilicity can significantly impact the PEC activity and stability47. For example, improved hydrophilicity can facilitate interfacial interactions between the electrode and electrolyte, accelerate photogenerated charge carrier transfer and separation48, and increase the gas release rate49. Consequently, the improved hydrophilicity provides an essential contribution to the improved PEC performance after HF treatment.

Additionally, to determine the change in defect properties after HF treatment, highly sensitive optical absorption measurements were performed via photothermal deflection spectroscopy (PDS) before and after HF treatment (Supplementary Fig. 15). Ta3N5(O) and Ta3N5(N) are characterized by a small reduction in the sub-bandgap absorption, while Ta3N5(Ta) exhibits rather similar absorption before and after HF treatment. Accordingly, we conclude that removal of the disordered surface layer leads to partial elimination of mid-gap defect states. To link changes in surface properties to charge transport/transfer characteristics, we performed both electrochemical impedance spectroscopy (EIS) and photoelectrochemical impedance spectroscopy (PEIS) on Ta3N5(O) thin films with and without HF treatment in 1 M KPi and 0.1 M K4Fe(CN)6 as a hole scavenger. In detail, we recorded EIS over a potential range from −0.1 VRHE to 1.6 VRHE and a frequency range from 1 Hz to 100 kHz (Supplementary Fig. 16). The data were fitted with an equivalent circuit to describe Ta3N5 in contact with the electrolyte (Supplementary Fig. 16c). The assignment of the circuit elements, as shown below, is consistent with previous EIS interpretations for Ta3N5 in literature21,50,51. We used the fitted capacitances from broadband EIS to derive the Mott–Schottky plot (C−2 vs. VRHE) of Ta3N5(O) with and without HF treatment. For as-grown Ta3N5(O), we observe a two-slope behavior, with a change in slope at higher applied potentials (Supplementary Fig. 16d). This behavior, previously observed in Ta3N5, suggests that band bending responds to the applied potential to varying degrees across different potential regions21. In the low potential region, the response is consistent with Fermi level pinning due to the existence of a distribution of surface states. At more anodic potentials, partial depinning of the Fermi level leads to a stronger dependence of the band bending on the potential, corresponding to a depletion-dominated regime21. After HF treatment, the Mott–Schottky response approaches the single-regime behavior over the investigated potential range. Complementary PEIS measurements show that the radius of the semicircle decreases at comparable applied potentials after HF treatment (Supplementary Fig. 17), indicating a lower overall resistance under operating conditions and more favorable photoelectrochemical charge-transfer characteristics.

Overall, the improved PEC characteristics are consistent with the GIWAXS results, which show that HF treatment removes the disordered oxide layer. This structural and chemical modification of the surface is especially pronounced in Ta3N5(O) photoelectrodes. Importantly, the effect of HF extends beyond the elimination of disordered surface layers by also increasing the hydrophilicity of the surface. Together, these changes could lead to fewer electronic trap states, diminished charge carrier recombination, and more efficient interfacial charge transfer. The observed enhancement in photocurrent performance confirms that surface defects and disorder limit efficient hole transfer, and that even a brief HF treatment can significantly improve the interfacial properties of Ta3N5 photoanodes.

In summary, we systematically investigated how thin film precursor selection impacts defect formation and distribution in Ta3N5 photoelectrodes, both at the surface and in the bulk. Using a combination of depth-sensitive characterization methods, including GIWAXS, XAS, ERDA, and PL, we identified clear differences between surface and bulk characteristics as a function of the defect properties. The surfaces of all films exhibited pronounced oxygen enrichment along with higher structural disorder and increased concentrations of deep-level defects compared to their bulk counterparts. However, the chemical nature of the precursor strongly influences these characteristics, with oxygen-rich precursors forming amorphous oxide-rich surfaces that exhibit fewer deep-level defects. In contrast, Ta precursors produced crystalline surfaces, but with increased densities of mid-gap defect states. Removing the disordered surface layer using a brief hydrofluoric acid treatment leads to improved surface crystallinity and increased hydrophilicity, as well as reduced oxygen content. Consequently, enhanced PEC performance and stability are observed for ferrocyanide oxidation even for Ta3N5 films with large deep-level defect concentrations. These findings highlight the necessity of independently optimizing surface and bulk properties to effectively enhance the efficiency and stability of Ta3N5-based photoelectrodes.