Cognitive flexibility, the capacity to adjust behavior to changing situational demands, is frequently linked to resilience because of its important contribution to stress regulation. In this context, particularly affective flexibility, defined as the ability to flexibly attend and disengage from affective information, may play a significant role. However, there are so far only very few empirical investigations that directly explore the link between flexibility and resilience to stress. In the present study, the relationship of cognitive and affective flexibility and resilience was examined in 100 healthy participants. Resilience was measured with three self-report questionnaires, two defining resilience as a personality trait and one focusing on resilience as an outcome in the sense of stress coping abilities. Cognitive and affective flexibility were assessed in two experimental task switching paradigms with non-affective and affective materials and tasks, respectively. The cognitive flexibility paradigm additionally included measures of cognitive stability and dispositional cognitive flexibility. In the affective flexibility paradigm, we explicitly considered the affective valence of the stimuli before and during task switching. Response time switch costs in the affective flexibility paradigm were significantly correlated to all three self-report measures of resilience. Regarding the valence of the stimuli, the correlation with resilience was not specific to costs when switching from negative to positive information or vice versa. For cognitive (i.e., non-affective) flexibility, a significant correlation of response time switch costs was found with only one of the three resilience measures. A regression analysis including both affective and cognitive switch costs as predictors of resilience indicated that only affective, but not cognitive switch costs, explained unique variance components. Furthermore, the experimental measures of cognitive stability and dispositional cognitive flexibility did not correlate with resilience scores. These findings suggest that specifically the efficiency of flexibly switching between affective and non-affective information is related to resilience.