Optical properties of Al nanogrids of different pitches and gaps were investigated both theoretically and experimentally. Three-dimensional finite-difference time-domain simulation predicted that surface plasmons at the air/Al interface would enhance ultraviolet transmission through the subwavelength gaps of the nanogrid, making it an effective electrode on GaN-based photodetectors to compensate for the lack of transparent electrode and high p-type doping. The predicted transmission enhancement was verified by confocal scanning optical microscopy performed at 365 nm. The quality of the nanogrids fabricated by electron-beam lithography was verified by near-field scanning optical microscopy and scanning electron microscopy. Based on the results, the pitch and gap of the nanogrids can be optimized for the best trade-off between electrical conductivity and optical transmission at different wavelengths. Based on different cutoff wavelengths, the nanogrids can also double as a filter to render photodetectors solar-blind.