Remove the solids without spreading them
Put on disposable gloves before you touch anything. Use a spoon, a plastic scraper or a stiff piece of paper to lift the solid material off the carpet. Place it in a bag and throw it away. Scrape from the outside edge toward the center so you do not smear the mess across the carpet.
If the material has already been trodden in, it can be hard to lift. Scrape gently and avoid pressing it deeper into the pile.
Blot the residue
After the solids are gone, press dry paper towels onto the area and keep replacing them until little more comes up. Do not rub. Rubbing pushes the mess into the carpet and spreads the stain. A slight damp residue can usually be lifted with blotting alone.
Clean with cool water and an enzyme cleaner
Pour a small amount of cool water on the spot and blot again. Cool water is safer than hot water, which can set the proteins and fats in the stain.
Then apply an enzyme cleaner made for pet stains. Follow the label, use enough to reach the backing, and keep the area damp for the time listed. Blot and let it air dry. Test the product on a hidden spot first, since some carpets react to certain ingredients.
Hygiene: gloves and washing hands
Dog feces can carry germs, so wear gloves for the whole process. Use a bag for the solids and seal it before throwing it away. Wash your hands afterward, even if you were wearing gloves. Clean any tools you used, and keep children and other pets away from the spot until it is dry.
When the stain is still visible
Some dog poop stains leave a brownish or yellowish mark, especially on light carpet. A second treatment with an enzyme cleaner may help. Give each treatment time to dry before you judge the result.
If the mark remains after several attempts, a carpet cleaner may have better options. Do not use bleach or strong peroxide without testing on a hidden spot first, since they can change the carpet color.
Drying and odor
Dry the area completely with fans or an open window. Damp carpet can keep the smell alive and invite mildew. Once the spot is dry, sprinkle a little baking soda, leave it for several hours, and vacuum it up to help with odor.
Preventing future accidents
Consistent routines help most. Take your dog out at regular times, especially after meals and naps, and reward good outdoor behavior. If accidents on carpet happen often, talk to a vet to rule out digestive or medical causes. Clean the first accident thoroughly, since a leftover smell can draw a dog back to the same spot.