The phrase means to identify something precisely, to make exactly the right point, or to describe a situation with perfect accuracy. A colleague who hits the nail on the head has articulated something that everyone was thinking but couldn't quite say. An analyst who hits the nail on the head has identified the exact cause of a problem.
The metaphor is entirely literal. Driving a nail efficiently requires striking its head squarely. A direct, accurate strike drives the nail cleanly. A glancing blow bends the nail, splits the wood, or wastes effort. The precision required — hitting a small, specific target — directly parallels the precision of saying exactly the right thing or identifying the exact truth.
The phrase is among the oldest surviving English idioms. It appears in John Heywood's 1546 collection of English proverbs, though it was in use before that. Related Latin phrases with the same carpentry metaphor ('rem acu tangere' — to touch the thing with a needle) suggest the concept is even older. Unlike many idioms whose origins are debated, this one has a clear and consistent explanation that matches its form perfectly.
Rarely — the phrase is almost always used sincerely to acknowledge someone's accuracy or insight. 'You've hit the nail on the head' is a genuine compliment in nearly all contexts.
'Miss the point entirely' or 'miss the mark' serve as rough opposites — describing an analysis or statement that fails to identify what matters.