Lipopolysaccharide (LPS) in the outer membrane of Gram-negative bacteria is critical for their cell envelope assembly. LPS synthesized in the cytoplasmic leaflet of the inner membrane is flipped to the periplasmic leaflet by MsbA, an ATP-binding cassette transporter. Despite substantial efforts, the structural mechanisms underlying MsbA-driven LPS flipping remain elusive. Here, we use single-particle cryo-EM to elucidate the structures of lipid nanodisc-embedded MsbA in three functional states. The 4.2 Å-resolution structure of the transmembrane domains of nucleotide-free MsbA reveals that LPS binds deeply inside MsbA at the height of the periplasmic leaflet, establishing extensive hydrophilic and hydrophobic interactions with MsbA. Two subnanometer-resolution structures of MsbA with ADP-vanadate and ADP reveal an unprecedented closed and an inward-facing conformation, respectively. Our study uncovers the long-sought-after structural basis for LPS recognition, delineates the conformational transitions of MsbA to flip LPS, and paves the way for structural characterization of other lipid flippases.