Maggots are repulsive little fly larvae that no one wants to live with. If you find them in your carpet, it likely means there is spilled food or a pet accident on the rug that you didn't find. The maggots can be removed, so resist the urge to set the carpet on fire. You'll have to be careful with your cleaning, however, to avoid damaging the carpet itself. Bleach, hydrogen peroxide and other frequently recommended household maggot killers will ruin the very rug you're trying to save. Instead, use a bit of boric acid and a vacuum cleaner to safely remove your uninvited guests.
Step 1 Find the Attractant
Take a good look around and examine your carpet closely to determine what attracted the insects. You will need to make sure to remove the attractant once you have eliminated the maggots. If you don't, they may come back.
Step 2 Kill the Maggots
Sprinkle boric acid powder liberally over your carpet. Use a broom or brush to sweep it into the carpet, pushing it as deeply into the rug fibers as you can. The edges of boric acid crystals are rough and will cut into the maggots, killing them.
Step 3 Vacuum
Vacuum your carpet thoroughly to remove the dead maggots and boric acid from the carpet. If you still see maggots, apply more boric acid to the carpet and vacuum it again. When you've finished, remove the vacuum's bag, wrap it tightly in a plastic bag, and immediately dispose of it in an outdoor trash can. If your vacuum cleaner has a canister rather than a bag, pour bleach onto the maggots in the canister to ensure they are dead and then dispose of them in an outdoor trash can. Clean your vacuum canister thoroughly with bleach and then rinse.
Step 4 Steam Clean
Kill any maggots you may have missed, and remove the stain that is attracting flies, by steam cleaning your carpet. Dispose of the water in the steam cleaner outdoors or flush it down your toilet. If you don't own a steam cleaner, you can rent one from most grocery stores.