How do weed killers kill off only weeds?

Weed killers are also called herbicides. Some herbicides will kill most plant life they come into contact with, but others are more selective. They vary in the types of weed they kill, the most common being broad-leafed plants while leaving grassy plants unscathed.

Herbicides work by inhibiting the growth of cells in the plant. They do this by targeting the enzymes responsible for fat formation thereby halting the development of the cells. The enzymes that promote cell growth in broad-leafed plants are not the same enzymes as those in grassy plants, therefore the herbicides take advantage of this by targeting and disrupting one type of enzyme and not the other.

How effective the herbicide is depends on the application. If more than the recommended dose is applied then the herbicides could damage the plant you want to save.

Rik Sargent, Science Museum