Age-associated changes in gait are exacerbated when another task is performed simultaneously. We quantified the converse, i.e., the effects of walking on cognitive abilities, and determined the role of aging and executive function (EF) in any observed changes. 276 healthy older adults and 52 healthy young adults performed three cognitive tasks, i.e., serial 7 and 3 subtractions and phoneme-monitoring, while sitting and again while walking. Among the elderly, walking decreased performance on serial 3 and 7 subtractions and the number of phonemes counted (p<0.0001), but enhanced content recall. In contrast, for the young adults, walking did not alter serial 3 subtractions, phoneme-monitoring or content recall, while serial 7 subtraction performance decreased during walking (p=0.047). Measures of EF explained the age-associated changes in performance of the cognitive task during walking. Findings in both young and old subjects underscore the idea that gait is attention-demanding and is not a purely motor task. Even young, healthy adults demonstrate decreased cognitive performance while walking, when the cognitive task is sufficiently difficult. Age-associated declines in EF apparently contribute to the difference in dual tasking abilities during walking between young and older adults.