When humans are engaged in goal-related processing, activity in prefrontal cortex is increased. However, it has remained unclear whether this prefrontal activity encodes a subject's current intention. Instead, increased levels of activity could reflect preparation of motor responses, holding in mind a set of potential choices, tracking the memory of previous responses, or general processes related to establishing a new task set. Here we study subjects who freely decided which of two tasks to perform and covertly held onto an intention during a variable delay. Only after this delay did they perform the chosen task and indicate which task they had prepared. We demonstrate that during the delay, it is possible to decode from activity in medial and lateral regions of prefrontal cortex which of two tasks the subjects were covertly intending to perform. This suggests that covert goals can be represented by distributed patterns of activity in the prefrontal cortex, thereby providing a potential neural substrate for prospective memory. During task execution, most information could be decoded from a more posterior region of prefrontal cortex, suggesting that different brain regions encode goals during task preparation and task execution. Decoding of intentions was most robust from the medial prefrontal cortex, which is consistent with a specific role of this region when subjects reflect on their own mental states.