The phrase "What a piece of work is a man!" is attributed to William Shakespeare's play Hamlet, and is part of a monologue by the eponymous character concerning humans and their abilities.
The monologue, spoken in the play by Prince Hamlet to Rosencrantz and Guildenstern in Act II, Scene 2, follows in its entirety. Rather than appearing in blank verse, the typical mode of composition of Shakespeare's plays, the speech appears in straight prose:
Hamlet is saying that although humans may appear to think and act "nobly" they are really essentially "dust". Hamlet is expressing his melancholy to his old friends over the difference between the best that men aspire to be, and how they actually behave; the great divide that depresses him.
The speech was fully omitted from Nicholas Ling's 1603 First Quarto, which reads simply:
Yes faith, this great world you see contents me not,
No nor the spangled heauens, nor earth, nor sea,
No nor Man that is so glorious a creature,
Contents not me, no nor woman too, though you laugh.
This version has been argued to have been a bad quarto, a tourbook copy, or an initial draft. By the 1604 Second Quarto, the speech is essentially present but punctuated differently:
What a piece of work is a man, how noble in reason,
how infinite in faculties, in form and moving,
how express and admirable in action, how like an angel in apprehension,
how like a god!
Then, by the 1623 First Folio, it appeared as:
What a piece of worke is a man! how Noble in
Reason? how infinite in faculty? in forme and mouing
how expresse and admirable? in Action, how like an Angel?
in apprehension, how like a God? ...
J. Dover Wilson, in his notes in the New Shakespeare edition, observed that the Folio text "involves two grave difficulties", namely that according to Elizabethan thought angels could apprehend but not act, making "in action how like an angel" nonsensical, and that "express" (which as an adjective means "direct and purposive") makes sense applied to "action", but goes very awkwardly with "form and moving".