A gang of marauding bandits approaches a mountain village. The bandit chief recognizes they have ransacked this village before, and decides it is best that they spare it until the barley is harvested in several months.
One of the villagers happens to overhear the discussion. When he returns home with the ominous news, the despairing villagers are divided about whether to surrender their harvest or fight back against the bandits. In turmoil, they go to the village elder, who declares that they should fight, by hiring samurai to help defend the village.
Some of the villagers are troubled by this suggestion, knowing that samurai are expensive to enlist and known to lust after young farm women, but realize they have no choice. Recognizing that the impoverished villagers have nothing to offer any prospective samurai except food, the village elder tells them to "find hungry samurai."
The men go into the city, but initially are unsuccessful, being turned away by every samurai they ask sometimes rudely because they cannot offer pay other than three meals a day. Just as all seems lost, they happen to witness an aging samurai, Kambei, execute a cunning and dramatic rescue of a young boy taken hostage by a thief.
As Kambei walks towards town a young samurai, Katsushir, asks to become his acolyte. Kambei insists that he walk with him as a friend. Then the farmers ask Kambei to help defend their village; to their great joy, he accepts. Kambei, with Katsushir's assistance, then recruits four more masterless samurai (rnin) from the city, one by one, each with distinctive skills and personality traits.
Although Kambei had initially decided that seven samurai would be necessary, he plans to leave for the village with only the four that he has chosen because time is running short. The villagers beg him to take Katsushir also and, with some prodding by the others, he agrees. A clownish ersatz samurai named Kikuchiyo, whom Kambei had rejected for the mission, follows them to the village at a distance, ignoring their protestations and attempts to drive him away.
When the samurai arrive at the village, the villagers cower in their homes in fear, hoping to protect their daughters and themselves from these supposedly dangerous warriors. The samurai are insulted not to be greeted warmly, considering that they have offered to defend the village for almost no reward, and seek an explanation from the village elder.
Suddenly, an alarm is raised; the villagers, fearing that the bandits have returned, rush from their hiding places begging to be defended by the newly-arrived samurai. It turns out that Kikuchiyo, until this point merely a tag-along, has raised a false alarm. He rebukes the panicked villagers for running to the samurai for aid after first failing to welcome them to the village.
It is here that Kikuchiyo demonstrates that there exists a certain intelligence behind his boorish demeanour. The six samurai symbolically accept him as belonging with them, truly completing the group of wanderers as the "seven samurai."
As they prepare for the siege, the villagers and their hired warriors slowly come to trust each other. However, when the samurai discover that the villagers have murdered and robbed fleeing samurai in the past, they are shocked and angry, and Kyz, the most professional and calm of the samurai, even comments that he would like to kill everyone in the village.
The always clownish Kikuchiyo passionately castigates the other samurai for ignoring the hardships that the farmers face in order to survive and make a living despite the intimidation and harassment from the warrior class, in the process revealing his origins to Kambei, who suddenly perceives that Kikuchiyo is himself a farmer's son. "But who made them like this?" he asks. "You did!"
The anger the samurai had felt turns to shame, and when the village elder, alerted by the clamor that this revelation instigates, asks if anything is the matter, Kambei humbly responds that there is not. The samurai continue their preparations without any animosity, and soon afterward show compassion toward the farmers when they share their rice with an old woman who, her family having been killed by bandits, cries out that she merely wants to die.
The preparations for the defense of the village continue apace, including the construction of fortifications and the training of the farmers for battle. Katsushir, the youngest samurai, begins a love affair with Shino, the daughter of one of the villagers. Shino had been forced to masquerade as a boy by her father who hoped the deception would protect her from the supposedly lustful samurai warriors.
As the time for the raid approaches, two bandit scouts are killed, and one is captured and reveals the location of the bandit camp. Three of the samurai, along with a guide from the village, decide to carry out a pre-emptive strike. Many bandits are killed, but one of the samurai, Heihachi, suffers a fatal sword wound when his villager friend lost emotion control upon seeing his imprisoned wife commit suicide.
When the bandits arrive in force soon after this raid, they are confounded by the fortifications put in place by the samurai, and several are killed attempting to scale the barricades or cross moats. However, the bandits have a superior number of trained fighters, and possess three muskets, and are thus able to hold their own. Kyz decides to conduct a raid on his own to retrieve one of the muskets and returns with one several hours later.
Kikuchiyo, jealous of the praise and respect Kyz earns, particularly from Katsushir, later abandons his post to retrieve another musket, leaving his contingent of farmers in charge. Although he succeeds, the bandits attack the post, overwhelming and killing many of the farmers. Kambei is forced to provide reinforcements from the main post to drive the bandits out, leaving it undermanned when the bandit leader charges this position.
Although they are driven off, Gorobei is shot and killed and it is revealed that Yohei, Kikuchiyo's friend, was killed at his post. Apart from defense, the initial strategy of the samurai is to allow the bandits to enter a gap in the fortifications one at a time through the use of a closing "wall" of spears, and to then kill the lone enemy.
This is repeated several times with success, although more than one bandit manages to enter the village several times. On the second night, Kambei decides that the villagers will soon become too exhausted to fight and instructs them to prepare for a final, decisive battle. During the night, Katsushir's affair is revealed, and after an initial uproar, his amorous adventures provide comic relief to the embattled militia.
When morning breaks and the bandits make their attack, Kambei orders his forces to allow all 13 remaining bandits in at once. In the ensuing confrontation, most of the bandits are easily killed, but the leader takes refuge in a hut unseen. In what is portrayed as dishonorable act, he shoots Kyz in the back from the safety of the hut, killing him.
A despondent Katsushir seeks to avenge his hero, but an enraged Kikuchiyo bravely (and blindly) charges ahead of him, only to be shot in the belly himself. Although mortally wounded, Kikuchiyo ensures he kills the bandit chief, finally proving his worth as a samurai, before dying. Dazed and exhausted, Kambei and Shichirji sadly observe "we've survived once again," while Katsushir wails over his fallen comrades. The battle is ultimately won for the villagers.
The three surviving samurai, Kambei, Katsushir, and Shichirji, are left to observe the villagers happily planting the next rice crop.
The samurai reflect on the relationship between the warrior and farming classes: though they have won the battle for the farmers, they have lost their friends with little to show for it. "Again we are defeated," Kambei muses. "The farmers have won. Not us."
This melancholic observation sheds new light on Kambei's statement at the beginning of the film that he had "never won a battle." This contrasts with the singing and joy of the villagers, whose figuratively life-sustaining work has prevailed over war and left all warriors as the defeated party.