Fluorescent proteins of different colors are useful probes to study protein structure and function, and to investigate cellular events and conditions. Large efforts have focused on engineering new properties into fluorescent proteins via rational design and directed evolution. In addition to applications in imaging of protein expression level and subcellular localization, fluorescent proteins have been increasingly engineered to act as biosensors to track concentrations of small-molecule metabolites, enzyme activities, and protein conformational changes in living cells. Unlike small-molecule fluorescence biosensors, fluorescent proteins are genetically encodable, and thus can be expressed inside living cells. Attachment of organelle-specific signals to the proteins allows their localization to be specified. Recently, a new class of fluorescent protein biosensors has been developed to include unnatural amino acids as the sensing element. The unique chemical and physical properties of the unnatural amino acids enable sensor designs that cannot be realized by using the standard genetic code with the 20 canonical amino acids. In this chapter, we detail the general procedure for the genetic incorporation of unnatural amino acids. We further present two protocols for the in vitro and in vivo detection of hydrogen peroxide (H2O2) using a fluorescent protein biosensor that contains an unnatural amino acid, p-boronophenylalanine.