We investigated the effects of Mg dopant on the degradation of AlInGaN-based light emitting diodes (LEDs) and laser diodes (LDs) with InGaN multi-quantum wells (MQWs). Photoluminescence (PL) intensity of InGaN MQWs was significantly decreased with increasing the Mg intentional doping process in InGaN active region, indicating that Mg dopant could degrade the optical quality of InGaN MQWs. From secondary ion mass spectroscopy (SIMS) analysis of AlInGaN-based LDs grown on GaN/ sapphire and GaN substrate with different dislocation densities, we found that Mg concentration of LD on GaN/ sapphire was higher than that of LD on GaN substrate at the InGaN MQWs regions. Additionally, we observed that Mg atoms were significantly diffused from p-type layer to InGaN MQWs region in the LD structure after aging evaluation. From these results, we could conclude that Mg diffusion along threading dislocations is one of the major gradual degradation mechanisms of AlInGaN-based LD/ LEDs during the device operation under high voltage condition.