Fluorescent bioimaging technology has been widely used in clinic because of its high sensitivity, quick feedback, and no radiation. Among them, NIR-II imaging has lower absorption, tissue scattering, self-fluorescence, and higher signal-to-noise ratio. As a precursor of nanoprobe, BaYF5 is an excellent material due to its low phonon energy, which makes it easy to achieve rare earth ion energy level transition and obtain strong upconversion luminescence. A near-infrared II (NIR-II) rare earth fluoride nanoparticle (NP) BaYF5 : Yb3 + , Er3 + @ BaYF5 has been constructed. The luminescence principle of the material was deeply analyzed, and the influence of different doping ion ratio on fluorescence intensity was explored. Finally, the optimal doping ratio for this matrix material was obtained. In addition, according to the surface properties of the materials, the water solubility and biocompatibility of the NPs were significantly improved by the modification. Our work also systematically tested and analyzed the cytotoxicity, hematotoxicity, and tissue toxicity of the NPs and finally realized the high-resolution fluorescence imaging in living mice. This NP can be used as an effective and safe NIR-II contrastive agent, which provides the possibility for the detection and monitoring of physiological activity under deep tissue in vivo.