Mg redistribution into a subsequently regrown GaN epilayer by metalorganic chemical vapor deposition (MOCVD) is studied. Dopant profiles from secondary ion mass spectrometry (SIMS) on n-p-n GaN samples have been analyzed. The regrowth study in a Mg-free reactor reveals that a Mg-rich film is present on MOCVD as-grown GaN:Mg base layers and can be removed by an acid etch, and that a slow Mg decay into the sequentially regrown GaN results from this Mg-rich surface film. We believe the commonly seen Mg memory effect in MOCVD causes the accumulation of Mg on the surface. From a MOCVD regrowth on n-p-n GaN grown by molecular beam epitaxy (MBE), the Mg diffusion constant is calculated to be about 3 Â 10 À15 cm 2 /s at 1160 C for Mg concentrations between 5 Â 10 17 cm À3 and 1 Â 10 19 cm À3 . The roles of memory effect, surface segregation, and diffusion associated with Mg are addressed.