Carpets are like Velcro for bad odors. So, long after you've cleaned gas out of the carpet, the smell of spilled gas will linger. That's both unpleasant and potentially unhealthy since ingesting gasoline fumes can be hazardous to people and pets. Try a series of simple steps to gradually eliminate the scent of gas in your carpet.
Ventilate, Ventilate, Ventilate
Increasing airflow over the carpet should do a lot to eliminate the lingering gas fumes. If the weather is dry and your carpet is removable, spread it out on a tarp or hang it over a fence and let it air out all day. (The downside is that you might need to do some carpet stain removal after it's been outdoors around animals.) For gas spills on a car rug, leave all the doors open all day but only if you can leave the car somewhere secure, like inside a locked garage with windows open for ventilation.
Video of the Day
To ventilate a carpet that can't be moved, open all the windows. Set up multiple fans pointed at the carpet from different angles and run them all day. If you have a dual window fan with reversible blades, set both fans to exhaust to help pull air (and odors) out of the room. For a high-pile carpet, run a brush or broom through the pile every few hours to make sure all the fibers are exposed to moving air. It may take several days of running fans to make a difference if it was a relatively big gas spill.
Use Odor Absorbers
Ventilation can knock down the odor of spilled gas but probably won't eliminate it completely. Covering the carpet with material that absorbs odor molecules makes cleanup pretty easy. Sweep or vacuum the odor absorbers, and the gas fumes should (theoretically) go with them.
There are a lot of options. The DIY route is to sprinkle clay kitty litter or baking soda over the affected area. Use a half-inch-thick layer of the material on any part of the carpet where you can smell gas. Let it sit for a few hours and then sweep it off the carpet onto a hard floor and into a dustpan. Use a stiff-bristled brush to get as much of the odor absorber off the carpet as possible and then vacuum the carpet to pick up any remaining debris. This strategy prevents the vacuum from being clogged like it would if you tried to vacuum up large amounts of kitty litter or baking soda.
Alternatively, sprinkle an odor remover for carpets all over the area. These products have a baking soda base and are designed to be vacuumed up, making cleanup quicker and easier than it is with kitty litter.
Only use electrical appliances, like vacuums, to clean up after a gas spill once the gas itself is gone and only faint odors remain.
Deep Clean the Carpet
If ventilation and odor absorbers don't completely get rid of the gas smell, try deep cleaning the entire rug with caution. Different types of carpets require different types of cleaners. Even if your rug can't be cleaned with water, spritzing it with an enzymatic odor-removing carpet cleaner and blotting that up might work. Always test a rug cleaner on one small patch first to check that no color bleeds before using it on larger patches.
If that still doesn't work, call in a professional carpet cleaner or accept that your carpet is permanently damaged by gas and needs to be replaced.
If you ultimately decide that the carpet can't be saved because the gas odor is too strong, contact your local waste management program for guidance about getting rid of it. Because it's flammable, disposing of gasoline must be handled carefully. A carpet that has been saturated with gas may need to be dropped off at a hazardous waste site.