In the near future, advances In vitro fertilization and cloning has caused genetic duplicating in the population. Thus, potential partners must be screened to make sure they are not accidentally or deliberately incestuous. The breaking of this law is called Code 46.
William (Tim Robbins) falls for Maria (Samantha Morton) who is one making the false travel papers for people deemed unsafe by the "Sphinx" government. They have an affair in which they unknowingly break Code 46. Despite this, William who has become obsessed with Maria, tracks her down and they rediscover their love despite Maria having her memory wiped of him. They run off only to get in a car crash.
Now knowingly breaking the law, the government wipes William's mind of Maria and he returns to his family. Maria is banished to the primitive outer world and in a final torturous punishment, is left with her memories of William, the man she cannot be with.