All-inorganic cesium lead halide perovskite (CsPbX3; X = Cl, Br) nanocrystals (NCs) are synthesized via a modified hot injection method using 3-mercaptopropyltrimethoxysilane (MPTMS), together with oleic acid and oleylamine, for in situ passivation of the surface defects. The surface chemistry, revealed by Fourier transform infrared spectroscopy (FTIR) and x-ray photoelectron spectroscopy (XPS) techniques, shows an absence of Si-O-Si network and C-O groups on these in situ passivated CsPbX3 NCs, denoted as InMP-CsPbX3, which is in strong contrast to the counterpart NCs obtained via a postsynthesis exchange strategy. The x-ray diffraction (XRD) pattern indicates a lattice structure significantly strained from the cubic structure. The synthesis of these InMP-CsPbX3 NCs is highly reproducible, and the colloids are stable in nonpolar solvents. The emission wavelength of CsPb(Cl/Br)3 mixed halide perovskite NCs is tuned from 405 nm to 508 nm by reducing the nominal Cl/Br ratio, while the photoluminescence quantum yield (PLQY) is greatly enhanced over the whole spectral range. More importantly, the InMP-treatment is among the few strategies that are promising for electroluminescence in light-emitting diodes.