Set out a mixture of dish soap and water in a shallow container as a home remedy for killing gnats. You can also spray this solution on gnat-infested houseplants.
Add the water and a few drops of dish soap to a wide, shallow dish and stir until the soap is dissolved. Leave the dish out for several days and refresh as needed.
To kill gnats on houseplants, mix two tablespoons of dish detergent with one gallon of water. Liberally spray the soil and let the plant rest for an hour. Next, spray the plant with clear water to remove any soap still on the leaves.