In this study, nanoparticles (NPs) of various types and sizes are arranged to enhance both the omnidirectional light harvesting of solar cells and the light extraction of light emitting diodes (LEDs). A graded-refractive-index NP stack can minimize reflectance, not only over a broad range of wavelengths but also at different incident angles; the photocurrent of silicon-based solar cells an also be significantly improved omnidirectionally. In addition, the optical gradient of an NP stack can also enhance the light-extraction efficiency of LEDs, due to both the graded refractive index and the moderate surface roughness. Large particles having sizes on the same order of the wavelength of the incident light roughen the LED surfaces further and extract light from beyond the critical angle, as supported by three-dimensional finite-difference time-domain simulations. Using this approach, the photoluminescence intensity can be increased by up to sevenfold. The developed technique: arranging sequences of different NPs in graded-refractive-index stacks, and considering their ability to scatter light due to their sizes and optical constants, may also significantly improve the performance of various optoelectronic devices.