Dendritic cells (DCs) sample peripheral tissues of the body in search of antigens to present to T cells. This requires two processes, antigen processing and cell motility, originally thought to occur independently. We found that the major histocompatibility complex II-associated invariant chain (Ii or CD74), a known regulator of antigen processing, negatively regulates DC motility in vivo. By using microfabricated channels to mimic the confined environment of peripheral tissues, we found that wild-type DCs alternate between high and low motility, whereas Ii-deficient cells moved in a faster and more uniform manner. The regulation of cell motility by Ii depended on the actin-based motor protein myosin II. Coupling antigen processing and cell motility may enable DCs to more efficiently detect and process antigens within a defined space.