Diatoms are one of the most important phytoplankton on Earth. They comprise at least ten thousand species and contribute to up to 20% of the global primary production. Because of serial endosymbiotic events and horizontal gene transfers, diatoms have developed a "secondary plastid" bounded by four membranes containing a large phase-separated compartment, termed the pyrenoid. However, the physiological significance of this unique chloroplast morphology is poorly understood. Characterization of fundamental physiological parameters such as local pH in various subcellular compartments should facilitate a greater understanding of the physiological roles of the unique structure of the secondary plastid. A promising method to estimate local pH is the in situ expression of the pH-sensitive green fluorescent protein. Here, we first developed the molecular tool for the mapping of in situ local pH in the diatom Phaeodactylum tricornutum by heterologously expressing pHluorin2 in the cytosol, periplastidal compartment (PPC; the space in between two sets of outer and inner chloroplast envelopes), chloroplast stroma, and the pyrenoid matrix. Our data suggested that PPC and the pyrenoid matrix are more acidic than the adjacent areas, the cytosol and the chloroplast stroma. Finally, absolute pH values at each compartment were estimated from the ratiometric fluorescence of a recombinant pHluorin2 protein, giving pH values of approximately 7.9, 6.8, 8.0, and 7.5 respectively, for the cytosol, PPC, stroma, and pyrenoid of the P. tricornutum cells, indicating the occurrence of pH gradients and the associated electrochemical potentials at their boundary.