On a cold day the fictional 304th New York Regiment awaits battle beside a river. Eighteen-year-old Private Henry Fleming, remembering his romantic reasons for enlisting as well as his mother's resulting protests, wonders whether he will remain brave in the face of fear, or turn and run. He is comforted by one of his friends from home, Jim Conklin, who admits that he would run from battle if his fellow soldiers also fled. During the regiment's first battle, Confederate soldiers charge, but are repelled. The enemy quickly regroups and attacks again, this time forcing some of the unprepared Union soldiers to flee. Fearing the battle is a lost cause, Henry deserts his regiment. It is not until after he reaches the rear of the army that he overhears a general announcing the Union's victory.
Ashamed, Henry escapes into a nearby forest, where he discovers a decaying body in a peaceful clearing. In his distress, he hurriedly leaves the clearing and stumbles upon a group of injured men returning from battle. One member of the group, a "tattered soldier", asks Henry where he is wounded, but the youth dodges the question. Among the group is Jim Conklin, who has been shot in the side and is suffering delirium from blood-loss. Jim eventually dies of his injury, defiantly resisting aid from his friend, and an enraged and helpless Henry runs from the wounded soldiers. He next joins a retreating column that is in disarray. In the ensuing panic, a man hits Henry on the head with his rifle, wounding him. Exhausted, hungry, thirsty, and now wounded, Henry decides to return to his regiment regardless of his shame. When he arrives at camp, the other soldiers believe his injury resulted from a grazing bullet during battle. The other men care for the youth, dressing his wound.
The next morning Henry goes into battle for the third time. His regiment encounters a small group of Confederates, and in the ensuing fight Henry proves to be a capable soldier, comforted by the belief that his previous cowardice had not been noticed, as he "had performed his mistakes in the dark, so he was still a man". Afterward, while looking for a stream from which to obtain water with a friend, he discovers from the commanding officer that his regiment has a lackluster reputation. The officer speaks casually about sacrificing the 304th because they are nothing more than "mule drivers" and "mud diggers." With no other regiments to spare, the general orders his men forward.
In the final battle, Henry acts as the flag-bearer after the color sergeant falls. A line of Confederates hidden behind a fence beyond a clearing shoots with impunity at Henry's regiment, which is ill-covered in the tree-line. Facing withering fire if they stay and disgrace if they retreat, the officers order a charge. Unarmed, Henry leads the men while entirely escaping injury. Most of the Confederates run before the regiment arrives, and four of the remaining men are taken prisoner. The novel closes with the following passage:
It rained. The procession of weary soldiers became a bedraggled train, despondent and muttering, marching with churning effort in a trough of liquid brown mud under a low, wretched sky. Yet the youth smiled, for he saw that the world was a world for him, though many discovered it to be made of oaths and walking sticks. He had rid himself of the red sickness of battle. The sultry nightmare was in the past. He had been an animal blistered and sweating in the heat and pain of war. He turned now with a lover's thirst to images of tranquil skies, fresh meadows, cool brooks, an existence of soft and eternal peace.
Over the river a golden ray of sun came through the hosts of leaden rain clouds.

Question: How many Confederates are taken prisoner by the 30th in the final battle?
Answer: 4
Alternative answer: Four.