Many of us enjoy attracting butterflies to our gardens. We often have the sense that they come by chance, but it's not true. We can encourage them by meeting their needs.
Many caterpillars, which metamorphose into butterflies, require specific host plants for food. By selecting particular species, you can provide the basic habitat requirements for specific species that you'd like to see as adults. Since highly preferred hosts may be unattractive or eaten until they have few leaves, plan an out-of-the-way place for these hosts. You might also want to provide host plants for some of the more attractive moths.
Butterflies are attracted by sweet, pungent and acrid-smelling flowers that are orange, yellow, pink, purple and red. Plants that have deep throated, drooping or enclosed flowers are sometimes unsuitable for nectar-gathering. Some plant species, like those with white flowers that are fragrant at night, may attract moths.
Especially avoid use of Bacillus thuringiensis and broad-spectrum insecticides. Avoid any insecticide that is broadcasted into the environment.
Reference: FNPS.org