Optical nanosensors called PEBBLEs (Probe Encapsulated By Biologically Localized Embedding) are nano-scale sensing devices that encapsulate analyte-specific dyes inside a biologically inert matrix for quantitative measurements inside cells. PEBBLEs come in four types of matrices and can be delivered into cells via four methods. They work by either directly measuring ions and small molecules using fluorescent indicators, or using ion correlation with a silent ionophore and chromoionophore to indicate changes in pH. PEBBLEs protect cells from dyes and dyes from cellular interference while enabling rapid, minimally invasive intracellular measurements of ions and molecules.