The correlation between altered extracellular pH and various pathological conditions, including cancer, inflammation and metabolic disorders, is well known. Bulk pH measurements cannot report the extracellular pH value at the cell surface. However, there is a limited number of suitable tools for measuring the extracellular pH of cells with high spatial resolution, and none of them are commonly used in laboratories around the world. In this study, a versatile ratiometric nanosensor for the measurement of extracellular pH was developed. The nanosensor consists of biocompatible polystyrene nanoparticles loaded with the pH-inert reference dye Nile red and is surface functionalized with a pH-responsive fluorescein dye. Equipped with a targeting moiety, the nanosensor can adhere to cell membranes, allowing direct measurement of extracellular pH at the cell surface. The nanosensor exhibits a sensitive ratiometric pH response within the range of 5.5–9.0, with a calculated pKa of 7.47. This range optimally covers the extracellular pH (pHe) of most healthy cells and cells in which the pHe is abnormal, such as cancer cells. In combination with the nanosensors ability to target cell membranes, its high robustness, reversibility and its biocompatibility, the pHe nanosensor proves to be well suited for in-situ measurement of extracellular pH, even over extended time periods. This pH nanosensor has the potential to advance biomedical research by improving our understanding of cellular microenvironments, where extracellular pH plays an important role.