β-barrel proteins mediate nutrient uptake in bacteria and serve vital functions in cell signaling and adhesion. For the 14-strand outer membrane protein G of Escherichia coli, opening and closing is pH-dependent. Different roles of the extracellular loops in this process were proposed, and X-ray and solution NMR studies were divergent. Here, we report the structure of outer membrane protein G investigated in bilayers of E. coli lipid extracts by magic-angle-spinning NMR. In total, 1847 inter-residue 1H-1H and 13C-13C distance restraints, 256 torsion angles, but no hydrogen bond restraints are used to calculate the structure. The length of β-strands is found to vary beyond the membrane boundary, with strands 6-8 being the longest and the extracellular loops 3 and 4 well ordered. The site of barrel closure at strands 1 and 14 is more disordered than most remaining strands, with the flexibility decreasing toward loops 3 and 4. Loop 4 presents a well-defined helix.