Cognitive impairment is common in multiple sclerosis (MS), especially when assessed by neuropsychological tests that emphasize mental processing speed, episodic memory, and some aspects of executive function. In this Review, we question why some MS patients develop severe impairment in cognitive abilities, while cognitive ability remains intact in others. We find that the heterogeneity in neuropsychological presentation among patients with MS reflects the influence of many factors, including genetics, sex, intelligence, disease course, comorbid neuropsychiatric illness, and health behaviors. Neuropsychological deficits are also robustly correlated with brain MRI metrics. Male patients with early evidence of cerebral gray matter atrophy are most prone to impairment, whereas high premorbid intelligence improves the neuropsychological prognosis. Routine evaluation of cognition is useful for helping patients to navigate problems related to activities of daily living and work disability and, if reliable methods are employed, cognitive decline can be detected and included among the many clinical signs of disease progression or treatment failure. Pharmacological treatments for neuropsychological impairment are on the horizon, although presently no firm medical indications exist for the condition.