The Grammar Doctor

a while and awhile

"Awhile" and "a while" both mean "a period of time," but "awhile" is an adverb, and "a while" is a noun with an article.
After a preposition we need the noun form. We need the noun form after a linking verb.
It will be a while before you can get an appointment.

We need the noun form to function as a direct object after a transitive verb.
It will take a while to get used to our way of doing things.

If the word clearly modifies a verb, we need the adverb form:

BUT: He loitered around the office for a while before he went home.
back to confused and misused