Originally made of camphor, mothballs now commonly contain naphthalene or para-dichlorobenzene. Both naphthalene and para-dichlorobenzene change from a solid to a gas, or evaporate, and are toxic to moths and moth larvae. When clothing was stored, moths may eat away at the clothing and damage it. As a result, they are often used with stored clothing to prevent damage from from moths.
Some people use mothballs in an attempt to keep animals away like skunks. They might broadcast them under a deck or hang them in a bag as a deterrent. They are an annoyance to animals, but often have to be in large quantities which can annoy people as well.
For humans, the gas produced by moth balls is irritating to our eyes and lungs. It may also cause headaches, dizziness, nausea and is a suspected carcinogen. As mothballs can have serious health & safety issues, for example, if a baby or child ingests the mothball or inhales them. Consequently, extreme caution should be taken, if used at all.