Oedipus the King (also known as Oedipus Rex and Oedipus Tyrannus) is a Greek tragedy by Sophocles about Oedipus, a mythical character who was exposed on a mountainside as an infant in an effort to avoid a prophecy that he would kill his father, King Laius of Thebes. However, he was spirited away by a passing shepherd and raised in the court of King Polybus of Corinth. Hearing from an oracle that he was destined to kill his father and marry his mother, and believing Polybus and his wife to be his real parents, he left Corinth. Meeting Laius by chance on a road and not recognizing him, he got into an argument with him and killed him. Later he met and married Jocasta, living as King of Thebes; again, neither recognized the other.

The play begins after Thebes has been struck with plague by the gods in outrage at Oedipus' unintentional wrongdoing. The play shows Oedipus' investigation, which leads to his discovery of what he has done, and the consequences, which see him gouging out his eyes, and his mother and wife, Jocasta, hanging herself. The play depends very heavily on dramatic irony, with the audience expected to understand Oedipus' history well before he does.

Oedipus the King was the second of Sophocles' three Theban plays to be produced, but its events occur before those of Oedipus at Colonus or Antigone.

See also: Oedipal