The poem is an elegy to the speaker's recently deceased Captain, at once celebrating the safe and successful return of their ship and mourning the loss of its great leader. In the first stanza, the speaker expresses his relief that the ship has reached its home port at last and describes hearing people cheering. Despite the celebrations on land and the successful voyage, the speaker reveals that his Captain's dead body is lying on the deck. In the second stanza, the speaker implores the Captain to "rise up and hear the bells," wishing the dead man could witness the elation. Everyone adored the captain, and the speaker admits that his death feels like a horrible dream. In the final stanza, the speaker juxtaposes his feelings of mourning and pride.
Whitman wrote this poem shortly after President Abraham Lincoln was assassinated. It is an extended metaphor intended to memorialize Lincoln's life and work. The Captain represents the assassinated president; the ship represents the war-weathered nation following the Civil War; the "prize won" represents the salvaged union. The speaker, torn between relief and despair, captures America's confusion at the end of the Civil War. It was a time of many conflicting sentiments, and Whitman immortalizes this sense of uncertainty in "O Captain! My Captain!"
Whitman's poetry places a lot of emphasis on the individual. This particular poem explores a variation on that theme: the self vs. the other. The speaker struggles with balancing his personal feelings of loss with the celebratory mood resulting from the successful voyage. While the Civil War claimed many lives, it led to the reunification of the Union, so many Americans felt similarly divided. In Whitman's poem, the speaker believes that he should be part of the "other" group, celebrating the return to safety. However, his inner thoughts set him apart from the crowd as he tries to reconcile his emotional reaction to the Captain's death.
"O Captain! My Captain!" is the only Walt Whitman poem that has a regular meter and rhyme scheme. Often hailed as "the father of free verse," Whitman tended to write his poems without following any kind of ordered poetic form. However, "O Captain! My Captain!" is organized into three eight-line stanzas, each with an AABBCDED rhyme scheme. Each stanza closes with the words "fallen cold and dead," and the first four lines of each stanza are longer than the last four lines. Because this poem is an elegy to the dead, the more traditional format adds to its solemnity. Additionally, the regular meter is reminiscent of a soldier marching across the battlefield, which is fitting for a poem that commemorates the end of the Civil War.