Optical fiber pH sensors work by observing a change in the indicator’s optical signal caused by variations in pH and these indicators can be immobilized onto the surface of an optical fiber using a polymer matrix. How the composition of the polymer matrix changes pH detection range using the indicator (5(6)-carboxynaphthofluorescein (CNF)) has not been studied. Here we show that the composition of the polymer matrix affects the working pH ranges of optical fiber CNF sensors. We used acrylamide (AAm) or N -isopropylacrylamide (NIPAM) as the backbone monomer, and N , N ’-methylenebisacrylamide (BIS) as the crosslinker for the polymer matrix. We found that AAm-based pH sensors showed rapid response over the pH range 6.6 – 8.0, while the dynamic ranges of NIPAM-based sensors shifted to basic pH compared with AAm-based pH sensors. Furthermore, we found that an increased ratio of the backbone monomer, NIPAM, over the crosslinker, BIS, significantly shifted the working range to more basic pH values, covering a pH range of 8.1 – 10.3. Our results demonstrate that the polymer matrix can be a powerful means to control the indicator response of optical pH sensors. • Optical fiber pH sensors using the indicator, 5(6)-carboxynaphthofluorescein (CNF), were developed. • CNF was immobilized by entrapment in a polymer matrix on the fiber tip. • The backbone monomer was either acrylamide (AAm) or N-isopropylacrylamide (NIPAM), and the crosslinker was N, N'-methylenebisacrylamide (BIS). • AAm-based pH sensors showed response over the pH range 6.6 – 8.0, whereas the dynamic ranges of NIPAM-based sensors shifted to basic pH.