The optical properties of AlxGa1-xN epilayers were extensively investigated by using photoluminescence, optical absorption, photocurrent, and persistent photoconductivity measurements. For the AlxGa1-xN epilayers containing high Al composition, we observed the Stokes shift, and an anomalous temperature-dependent photoluminescence and persistent photoconductivity effect. These results show a strong dependence on Al contents in AlxGa1-xN epilayers. The magnitude of the Stokes shift is close to the localization depth determined from the persistent photoconductivity decay kinetics. The increase in the degree of localized states with large Al compositions is due to alloy compositional fluctuations. Also, the S-shaped behavior and Stokes shift can be described in terms of localized states formed by alloy potential fluctuations in AlxGa1-xN epilayers. © 2004 American Institute of Physics.