Awhile is an adverb meaning for a short period of time.
- Stay awhile.
- We waited awhile.
- Sit down and rest awhile.
A while is a noun phrase referring to a period of time.
- I haven’t seen you for a while.
- We stayed for a while.
- It took a while to finish.
Easy guide
If it follows for, you normally need a while.
Stay awhile.
Stay for a while.