Vial is a small container, as in the nurse drew the vaccine from a small glass vial. Vile is an adjective meaning disgusting or contemptible, as in a vile taste. If you can hold it, it is a vial; if you are describing how awful something is, it is vile.
The core difference
Vial is a noun for a small container, while vile is an adjective describing something disgusting or morally contemptible.
- vial — a small glass or plastic container for liquids: she kept a vial of perfume in her handbag.
- vile — morally disgusting or extremely unpleasant: the medicine had a vile, bitter taste.
How to tell them apart
A quick check: vial rhymes with dial, and both are things with a small, fixed shape you can hold. Vile rhymes with mile and while, and describes a quality, never an object.
The two get swapped in medical or lab contexts especially, where a sentence about a vial of medicine can accidentally read as a vile of medicine, changing a neutral description into an unintended insult.