Nanoporous GaN samples were prepared by UV-assisted electrochemical etching of Si-doped GaN using the HF-based electrolyte. The Si doping density in the as-grown GaN samples was varied from 1×1016to1×1019cm-3. The surface morphology and optical quality of these nanoporous GaN films are controlled by the doping density in the as-grown films. The scanning electron microscopy results reveal that the average pore size can be tuned from 100to45nm by increasing the carrier density in the as-grown GaN films from 1×1016to1×1019cm-3. Photoluminescence (PL) measurements indicate that the nanoporous GaN films exhibit a higher PL intensity with redshifted band-edge PL peak compared to the as-grown GaN films. The nanoporous GaN prepared from highly doped sample gives highest PL intensity and stress relaxation due to the presence of smallest size nanopores. The redshift of the E2(high) phonon mode in the Raman spectra of nanoporous GaN prepared from heavily Si-doped samples shows a significant relaxation of the compressive stress.