As the Civil War rages, three unscrupulous and unprincipled men live on the fringes of the law: Tuco (the Ugly), Joe (the Good), and Sentenza (the Bad). The Bad is searching for a treasure hidden in a grave by a certain Bill Carson, but a series of strange circumstances lead the Good to discover the name on the grave and the Ugly to pinpoint its location. The three, however, have no trust in each other, nor any desire to share the enormous sum in gold coins. Therefore, they separately begin the treasure hunt, until they eventually meet in a cemetery for the final showdown.