Memory formation requires representations of new information to be efficiently encoded by the brain memory network. Here, the authors used multivariate classification to determine encoding states that were predictive of later recall and those that were likely to lead to forgetting. In people with epilepsy who had intracranially implanted electrodes, stimulation of the memory network during states associated with efficient memory encoding disrupted memory formation, whereas, when the stimulation was applied during a period of inefficient encoding, memory was facilitated. Thus, the effect of stimulation on memory depends on the existing state of the memory network.