"All the world's a stage" is not a standalone poem or sonnet. It is a famous monologue from William Shakespeare's comedy As You Like It (Act II, Scene VII), spoken by the melancholy philosopher Jaques.
The speech presents the "Seven Ages of Man" metaphor—comparing life to a theatrical performance and humans to actors playing roles across infancy, schoolboy, lover, soldier, justice, pantaloon, and second childishness.
The line has inspired numerous poems and sonnets by later writers, including William Wordsworth, who used it as a title or thematic springboard. But in origin, it is a dramatic speech within a play—prose poetry in blank verse, not a formal sonnet.