All-inorganic halide perovskites (CsPbX3, X = Cl-, Br-, and I-) are brought to the forefront of research focus in the field of modern lighting technology. However, due to the toxic element (Pb2+), environmentally friendly white-light emissions are difficult to achieve, thus limiting their practical applications. Herein, high-quality Mg2+-alloyed CsPb1-xMgxX3 (up to 20%) nanocrystals (NCs) are synthesized. The structural and optical properties are investigated. The application of these NCs in white-light-emitting diodes (LEDs) is also demonstrated. The incorporation of Mg2+ into CsPb1-xMgxX3 NCs results in a lattice contraction without a change in structure and morphology, blue-shifts in the photoluminescence emission, and increased bandgap. Then, the tunable emission (approximate to 408-650 nm) is obtained by adjusting the compositions of different halides (for 20% Mg2+). Most importantly, for the first time, 3D printed thin color conversion layers for different color emitting NCs (green, yellow, and red) are stacked on top of the blue-LEDs to achieve high-quality white light emission. A bright neutral white-light with a correlated-color temperature of 5806 K, a high color-rendering index of 89, CIE coordinates of (0.32, 0.33), a small D-uv (<0.003), and high luminous efficacy of radiation of 280 lm W-1 is achieved.