Bacterial microcompartments are organelles composed of a protein shell that surrounds functionally related proteins. Bioinformatic analysis of sequenced genomes indicates that homologs to shell protein genes are widespread among bacteria and suggests that the shell proteins are capable of encapsulating diverse enzymes. The carboxysome is a bacterial microcompartment that enhances CO(2) fixation in cyanobacteria and some chemoautotrophs by sequestering ribulose-1,5-bisphosphate carboxylase/oxygenase and carbonic anhydrase in the microcompartment shell. Here, we report the in vitro and in vivo characterization of CcmN, a protein of previously unknown function that is absolutely conserved in beta-carboxysomal gene clusters. We show that CcmN localizes to the carboxysome and is essential for carboxysome biogenesis. CcmN has two functionally distinct regions separated by a poorly conserved linker. The N-terminal portion of the protein is important for interaction with CcmM and, by extension, ribulose-1,5-bisphosphate carboxylase/oxygenase and the carbonic anhydrase CcaA, whereas the C-terminal peptide is essential for interaction with the carboxysome shell. Deletion of the peptide abolishes carboxysome formation, indicating that its interaction with the shell is an essential step in microcompartment formation. Peptides with similar length and sequence properties to those in CcmN can be bioinformatically detected in a large number of diverse proteins proposed to be encapsulated in functionally distinct microcompartments, suggesting that this peptide and its interaction with its cognate shell proteins are common features of microcompartment assembly.