The major histocompatibility complex (MHC) class II protein can bind peptides of different lengths in the region outside the peptide-binding groove. Peptide-flanking residues (PFRs) contribute to the binding affinity of the peptide for MHC and change the immunogenicity of the peptide/MHC complex with regard to T cell receptor (TCR). The mechanisms underlying these phenomena are currently unknown. The molecular flexibility of the peptide/MHC complex may be an important determinant of the structures recognized by certain T cells. We used single-molecule x-ray analysis (diffracted x-ray tracking (DXT)) and fluorescence anisotropy to investigate these mechanisms. DXT enabled us to monitor the real-time Brownian motion of the peptide/MHC complex and revealed that peptides without PFRs undergo larger rotational motions than peptides with PFRs. Fluorescence anisotropy further revealed that peptides without PFRs exhibit slightly larger motions on the nanosecond timescale. These results demonstrate that peptides without PFRs undergo dynamic motions in the groove of MHC and consequently are able to assume diverse structures that can be recognized by T cells.