Mothballs repelling mice and rats is a common misconception. Mothballs contain a small amount of naphthalene and can be a deterrent in large quantities, however, they aren't powerful enough to get rid of mice and rodents.
What will repel mice?
Mothballs - Contain naphthalene and may deter mice when used in strong enough doses. Ammonia - Mimics the odor of predators' urine and can act as a repellent. Peppermint Oil, Cayenne Pepper, or Cloves - Have strong scents that may repel mice.
How do you keep mice out of your house?
In order to prevent mice from entering the home, all cracks, openings and holes should be sealed with metal or cement. All doors and windows must close properly. Store foods in glass or metal containers with tight lids, and be certain to dispose of all food waste as soon as possible.