Oedipus Rex, also known by its Greek title, Oedipus Tyrannus (Οἰδίπους Τύραννος), or Oedipus the King, is an Athenian tragedy by Sophocles that was first performed around 429 BC. Originally, to the ancient Hellenes, the title was simply Oedipus (Οἰδίπους), as it is referred to by Aristotle in the Poetics. It is thought to have been renamed Oedipus Tyrannus to distinguish it from another of Sophocles' plays, Oedipus at Colonus. In antiquity, the term “tyrant” referred to a ruler with no legitimate claim to rule, but it did not necessarily have a negative connotation.

Of Sophocles' three Theban plays that have survived, and that deal with the story of Oedipus, Oedipus Rex was the second to be written. However, in terms of the chronology of events that the plays describe, it comes first, followed by Oedipus at Colonus and then Antigone. Prior to the start of Oedipus Rex, Oedipus has become the king of Thebes while unwittingly fulfilling a prophecy that he would kill his father, Laius (the previous king), and marry his mother, Jocasta (whom Oedipus took as his queen after solving the riddle of the Sphinx). The action of Sophocles' play concerns Oedipus' search for the murderer of Laius in order to end a plague ravaging Thebes, unaware that the killer he is looking for is none other than himself. At the end of the play, after the truth finally comes to light, Jocasta hangs herself while Oedipus, horrified at his patricide and incest, proceeds to gouge out his own eyes in despair.

Oedipus Rex is regarded by many scholars as the masterpiece of ancient Hellenic tragedy. In his Poetics, Aristotle refers several times to the play in order to exemplify aspects of the genre.