A fragment is not a complete sentence and, therefore, a grammatical error because it lacks a subject, a predicate, or both. A subject and a predicate are both necessary to form a standard sentence. Here are examples of a correct sentence followed by three incorrect fragments:
Standard sentence: When Henry arrives, the meeting will begin.
Fragment, lacking subject: When Henry arrives, will begin.
Fragment, lacking predicate: When Henry arrives, the meeting.
Fragment, lacking subject and predicate: When Henry arrives.
Although we learned in school not to write fragments and our managers admonish us to write complete sentences, excellent writers frequently write them. Here is an example of breaking the standard sentence rule by the brilliant writer, Joan Didion, in her 2005 book The Year of Magical Thinking (page 128):
I remember learning at UCA the names of many tests and scales. The Kimura Box Test. The Two-Point Discrimination Test. The Glasgow Coma Scale, the Glasgow Outcome Scale.
The first sentence is fine, the next two are fragments and the last is a comma splice, also a nonstandard sentence we have been taught to avoid. So why do writers as great as Didion and their editors allow these fragments? For many reasons, including impact, rhythm, and variety. (The previous sentence is a fragment!) I do not tell people to never write them, but to use them only when their best judgment tells them a fragment works better than a complete sentence. If you've ever written in an email Thanks instead of I thank you, or Received instead of I received your attachment, or Done instead of We have completed the task, then you are writing fragments that most reasonable readers would say are preferable to their longer, correct counterparts.
While a carefully considered fragment may have its place in professional writing for the sake of brevity, we should avoid writing fragments like these:
Opening fragment: In response to your inquiry. (Prefer I am responding to your inquiry.)
Mid-message fragment: Consequently, falling behind schedule. (Prefer Consequently, the project is falling behind schedule.)
Closing fragment: Questions, 1-732-718-3361. (Prefer If you have questions, call 1-732-718-3361.)
If you are not sure of whether to write a sentence or a fragment, then write a sentence. That's what I said.