A while is a noun meaning “a length of time”
- “I slept for a while.”
- (compare with “I slept for a bit” and “I slept for three hours”)
“I was away from my desk for a while.” - (compare with “I was away from my desk for two minutes”)
Awhile is an adverb, meaning “for a time,” or literally, “for a while”.
- “I slept awhile before dinner.”
(compare with “I slept deeply before dinner” and “I slept badly before dinner”.)
As you can see, the words can be used almost interchangeably in some cases – but a while needs to be accompanied by a preposition, such as “for” (“I slept for a while”) or “ago” (“I left work a while ago”). Awhile always means “for a while”.
After stopping inHadley awhile, we drove to Deerfield
I thought awhile before I answered.