In late 1890s Wyoming, Butch Cassidy is the affable, clever, talkative leader of the outlaw Hole in the Wall Gang. His closest companion is the laconic dead-shot "Sundance Kid". The two return to their hideout at Hole-in-the-Wall (Wyoming) to discover that the rest of the gang, irked at Butch's long absences, have selected Harvey Logan as their new leader.
Harvey challenges Butch to a knife fight over the gang's leadership. Butch defeats him using trickery, but embraces Harvey's idea to rob the Union Pacific Overland Flyer train on both its eastward and westward runs, agreeing that the second robbery would be unexpected and likely reap even more money than the first.
The first robbery goes well. To celebrate, Butch and Sundance visit a favorite brothel in a nearby town and watch, amused, as the town sheriff unsuccessfully attempts to organize a posse to track down the gang. They then visit Sundance's lover, schoolteacher Etta Place.
On the second train robbery, Butch uses too much dynamite to blow open the safe, blowing up the baggage car. As the gang scrambles to gather up the money, a second train arrives carrying a six-man team of lawmen pursuing Butch and Sundance, who unsuccessfully try to hide out in the brothel and to seek amnesty from the friendly Sheriff Bledsoe by enlisting in the army.
As the posse remains in pursuit, despite all attempts to elude them, Butch and Sundance determine that the group includes renowned Indian tracker "Lord Baltimore" and relentless lawman Joe Lefors, recognizable by his white skimmer. Butch and Sundance finally elude their pursuers by jumping from a cliff into a river far below. They learn from Etta that the posse has been paid by Union Pacific head E. H. Harriman to remain on their trail until Butch and Sundance are both killed.
Butch convinces Sundance and Etta that the three should escape to Bolivia, which Butch envisions as a robber's paradise. On their arrival there, Sundance is dismayed by the living conditions and regards the country with contempt, but Butch remains optimistic. They discover that they know too little Spanish to pull off a bank robbery, so Etta attempts to teach them the language. With her as an accomplice, they become successful bank robbers known as Los Bandidos Yanquis. However, their confidence drops when they see a man wearing a white hat (the signature of determined lawman Lefors) and fear that Harriman's posse is still after them.
Butch suggests "going straight", and he and Sundance land their first honest job as payroll guards for a mining company. However, they are ambushed by local bandits on their first run and their boss, Percy Garris, is killed. Butch and Sundance ambush and kill the bandits, the first time Butch has ever shot someone. Etta recommends farming or ranching as other lines of work, but they conclude the straight life isn't for them. Sensing they will be killed if they return to robbery, Etta decides to go back to the United States.
Butch and Sundance steal a payroll and the mules carrying it, and arrive in a small town. A boy recognizes the mules' brand and alerts the local police, leading to a gunfight with the outlaws. They take cover in a building but are both seriously wounded, after Butch makes a futile attempt to run to the mules in order to bring more ammunition, while Sundance provides cover fire. As dozens of Bolivian soldiers surround the area, Butch suggests the duo's next destination should be Australia. They charge out of the building guns blazing, directly into a firing squad.