While stress is thought to play an important role in the development of self-organized porous films, mechanisms of stress generation during anodizing are not yet understood. In order to reveal depth distributions of stress in anodic films, phase-shifting curvature interferometry was used to monitor force transients (in-plane stress integrated through the sample thickness) during formation of anodic oxides on aluminum in phosphoric acid, as well as subsequent open-circuit dissolution. The measurements were not influenced significantly by electrostatic stress, internal stress in the metal samples, thermal stress, or stress induced by open-circuit dissolution. At typical current densities, the force became more compressive during anodizing, while a net tensile force change was measured after anodizing followed by complete oxide dissolution. Thus, it was revealed that anodizing generates both compressive stress in the oxide and tensile stress near the metal-oxide interface. Analysis of the open-circuit stress change revealed separate contributions from diffusional stress relaxations, and removal of residual oxide stress by dissolution. Residual stress distributions in the oxide, at nanometer depth resolution, were determined from measurements of dissolution rate and stress at open circuit, and validated through variations of the open-circuit dissolution rate.