We report the determination of the energy-band offsets between GaN and AlN using the linewidth (full width at half maximum) of an extremely sharp excitonic luminescence transition in Alx Ga1-x N alloy with x=0.18 at 10 K. Our sample was grown on C -plane sapphire substrate by metal-organic chemical-vapor deposition at 1050 °C. The observed value of the excitonic linewidth of 17 meV is the smallest ever reported in literature. On subtracting a typical value of the excitonic linewidth in high-quality GaN, namely, 4.0 meV, we obtain a value of 13.0 meV, which we attribute to compositional disorder. This value is considerably smaller than that calculated using a delocalized exciton model [S. M. Lee and K. K. Bajaj, J. Appl. Phys. 73, 1788 (1993)]. The excitons are known to be strongly localized by defects and/or the potential fluctuations in this alloy system. We have simulated this localization assuming that the hole, being much more massive than the electron, is completely immobile, i.e., the hole mass is treated as infinite. Assuming that the excitonic line broadening is caused entirely by the potential fluctuations experienced by the conduction electron, the value of the conduction-band offset between GaN and AlN is determined to be about 57% of the total-band-gap discontinuity. Using our model we have calculated the variation of the excitonic linewidth as a function of Al composition in our samples with higher Al content larger than 18% and have compared it with the experimental data. We also compare our value of the conduction-band offset with those recently proposed by several other groups using different techniques.