Rare-earth oxyfluoride (REOF) colloidal nanocrystals (NCs) suffer from a low photoluminescence efficiency due to their small size with poor crystallinity and a detrimental surface quenching effect. Herein, we introduce an innovative approach that involves doping sodium ions into REOF NCs to produce monodisperse, size-controllable, well-crystallized, and highly luminescent colloidal REOF core/shell NCs. The Na+ doping allows for successfully synthesizing the cubic REOF NCs with a tunable size from 6 to 30 nm. Further fabrication of the core/shell NCs doped with Na+ results in enhancements up to 1062 (Ho3+), 1140 (Er3+), and 2212 (Tm3+) folds in upconversion luminescence and 17.7 folds (Er3+) in downconversion luminescence compared to that of core/shell NCs without doping Na+ ions. These NCs were subsequently developed into multicolor luminescent inks, demonstrating significant potential application for information security, and used for near-infrared-IIb (NIR-IIb) (1500-1700 nm) in vivo imaging, which exhibits a high-resolution in vivo dynamic imaging capability with a signal-to-noise ratio of 5.28. These results present the way to the controlled synthesis of efficient luminescent cubic LuOF: RE3+/LuOF core/shell NCs, expanding the toolkit of rare-earth doped NCs in diverse applications such as advanced encoding encryption, varied fluorescence imaging, and biomedicine.