Resistive random access memories have raised as one of the most promising devices to store information due to their great yield and easy fabrication. In these cells, the memory concept is based on tuning the electrical resistance of the insulating layer in a metal-insulator-metal structure by applying electrical signals, so that a high resistive state (HRS or “0”) and a low resistive state (LRS or “1”) can be reached. Among all insulator candidates, hafnium oxides are the most preferred due to their good performance and compatibility with the existent microelectronic technology. It is widely known that the resistance switching (RS) mechanism in HfO2 stacks is based on the reversibility of the dielectric breakdown (BD), which is a local phenomenon that takes place in areas of ~100 nm2. Therefore, the use of electrical characterization tools with high spatial resolution is necessary to fully understand the conductivity changes in the dielectric. In this work, we use advanced nanoscale characterization tools to elucidate the origin of resistive switching in hafnium-based oxides.Hafnium oxide thin films with different thicknesses and morphologies are analyzed using a Semiconductor Parameter Analyzer (SPA) connected to a Conductive Atomic Force Microscope (CAFM) working in controlled atmospheres (dry Nitrogen and a vacuum of 10-7 torr). Ramped Voltage Stresses have been performed at single locations of the samples to induce the formation of Conductive Filaments (CFs) - reach the dielectric breakdown (BD), or forming - . We analyze one-by-one the reversibility of those CFs, and we discern those locations where the BD could be recovered. Our experiments indicate that RS is only reachable at those filaments formed at the grain boundaries (GBs) of pseudo-amorphous and poly-crystalline samples (induced by thermal annealing), while the CFs induced at the nanocrystals or through the amorphous samples became irreversible (even using a current limitation). Kelvin Probe Force Microscope maps reveal that GBs are rich in defects, which correlates to larger leakage currents in (current maps) and lower BD voltages (forming, in IV curves). The lower BD voltages observed at the GBs (which, interestingly, coincide to those observed in MIM capacitors) may produce a less dramatic BD event, leading to narrower filaments easier to reoxidize. Moreover, the absolute value of the currents observed in LRS though a CF and a MIM structure are similar, indicating that RS in HfO2 stacks is a local phenomenon. This hypothesis is further supported by the fact that the currents through a CF in HRS and LRS can be fitted to the soft- and hard-BD equations. Finally we also show that, apart from creating/analyzing single CFs, the CAFM can also be used to perform statistical analyzes of the density, current and size of the CFs. In this case, two experiments are suitable to provide such information. The first consists of inducing the stresses in real capacitors, and scanning the surface of the insulator after etching the top electrode; and the second consists of collecting sequences of current maps at the same location of the sample using different voltages to observe a complete set-reset-set cycle. Since the maps cover larger areas and generate many filaments, this second test can be even combined with chemical analyses of lower spatial resolution.In summary, CAFM experiments allow the correlation between nanoscale morphological features and electrical signals, and they can provide essential information to understand the origin of RS. In this work, CAFM studies experimentally in-situ proved, for the first time, that resistive switching in HfO2 stacks only takes place at the grain boundaries in polycrystalline samples due to an unusual high concentration of defects that minimize the violence of the BD event.