Bacterial microcompartments (BMCs) are organelles composed entirely of protein. They promote specific metabolic processes by encapsulating and colocalizing enzymes with their substrates and cofactors, by protecting vulnerable enzymes in a defined microenvironment, and by sequestering toxic or volatile intermediates. Prototypes of the BMCs are the carboxysomes of autotrophic bacteria. However, structures of similar polyhedral shape are being discovered in an ever-increasing number of heterotrophic bacteria, where they participate in the utilization of specialty carbon and energy sources. Comparative genomics reveals that the potential for this type of compartmentalization is widespread across bacterial phyla and suggests that genetic modules encoding BMCs are frequently laterally transferred among bacteria. The diverse functions of these BMCs suggest that they contribute to metabolic innovation in bacteria in a broad range of environments.