The overexpression of microRNA-21 is closely related to many human diseases, so the development of probes for this bio-marker will contribute to the diagnosis. In this scheme, a novel ratiometric upconversion nanoprobe based on fluorescence resonance energy transfer (FRET) was developed for the analysis of microRNA-21. This nanosystem is composed of upconversion nanoparticles (UCNPs), PEG with antifouling performance and targeted folic acid (FA). Er3+ doped UCNPs were used as energy donors and carboxy-X-rhodamine (ROX) acted as energy receptors. MicroRNA-21 was visually analyzed by ratiometric upconversion luminescence (548 nm/616 nm), and the limit of detection (LOD) was quantified to be 9.95 pM. This nanocomposite can not only realize the detection and imaging for microRNA-21 in cells, but also visualize microRNA-21 level in vivo by upconversion luminescence due to the deep tissue penetration of UCNPs.