We used functional magnetic resonance imaging to investigate brain activity while healthy subjects performed three different tasks, each of which alternated between: (i) phases relying on stimulus-oriented thought (i.e. cognitive processes provoked by incoming sensory information); and (ii) phases relying on stimulus-independent thought (i.e. cognitive processes that were not related to any information in the immediate sensory environment). Within each task, the two phases were matched as closely as possible. In all three tasks, lateral rostral prefrontal cortex was transiently activated by a switch between stimulus-oriented and stimulus-independent thought (regardless of the direction of the switch). Medial rostral prefrontal cortex consistently exhibited sustained activity for stimulus-oriented vs. stimulus-independent thought. These results suggest the involvement of rostral prefrontal cortex in selection between stimulus-oriented and stimulus-independent cognitive processes.