Despite the fact that Charlie Kaufman's script and Michel Gondry's visual concepts were closely followed, the cast members were allowed many chances to improvise. Elijah Wood and Mark Ruffalo improvised extensively, and much of the dialogue between Jim Carrey and Kate Winslet resulted from videotaped rehearsal sessions, during which, the two became close by sharing tales of their real-life relationships and heartbreaks.
The idea for this film was brought to Michel Gondry by his friend, artist Pierre Bismuth, who suggested, "You get a card in the mail that says: someone you know has just erased you from their memory."
During the train scene, Kate Winslet punches Jim Carrey. This was not staged nor planned, and Carrey's response is that of genuine surprise.
Initially, throughout the train scene, the music was supposed to fill up the gap during the silence between Joel and Clementine, until screenwriter Charlie Kaufman suggested to do the opposite. Music was then played when Joel and Clementine talked, and paused when they paused.
When Joel is in his head, and is visiting his session of the erasing process, no special effects were used to show the two Joels in the one scene. Jim Carrey had to take off his hat and jacket when he was not in the shot and had to quickly sit down in the chair, and vice-versa when he has to stand up.