How to Get Rid of Fungus Gnats in Your Terrarium
Fungus gnats are the most common terrarium pest. Learn why they appear, how to eliminate them naturally, and prevent future infestations.

Those tiny flies hovering around your terrarium are almost certainly fungus gnats. While they rarely kill plants directly, their larvae feed on organic matter and roots, weakening your terrarium ecosystem over time. The good news is that they are entirely manageable with the right approach.
Understanding Fungus Gnats
Fungus gnats (family Sciaridae) thrive in moist, organic-rich environments, which makes terrariums their ideal habitat. Adult gnats are mostly a nuisance, but the larvae living in your soil are the real problem.
Life Cycle
Understanding their life cycle helps you target them effectively:
- Eggs: Laid in moist soil surface, hatch in 4-6 days
- Larvae: Feed for 12-14 days in soil
- Pupae: 3-4 day transformation period
- Adults: Live 7-10 days, lay up to 200 eggs
The entire cycle takes about 3-4 weeks, which means consistent treatment for at least one month is essential.
Why Your Terrarium Has Gnats
Common Entry Points
Gnats typically enter your terrarium through:
- Contaminated soil - Most common source
- Infected plants - Brought in from nurseries
- Open containers - Flying in from houseplants
- Decorative materials - Moss, bark, leaves
Conditions That Attract Them
- Constantly wet soil surface
- Decomposing organic matter
- Poor air circulation
- Lack of natural predators
Immediate Actions
Step 1: Reduce Moisture
The soil surface is where gnats lay eggs. Let the top layer dry slightly:
- Open your terrarium lid for a few hours daily
- Remove any standing water
- Avoid misting for 3-5 days
For closed terrariums, this temporary drying period will not harm established plants.
Step 2: Remove Visible Larvae
Check the soil surface, especially around plant bases:
- White, translucent larvae with black heads
- Usually found in top 1 inch of soil
- Remove manually with tweezers
Step 3: Trap Adults
Yellow sticky traps are highly effective:
- Place small pieces inside the terrarium
- Replace every 3-4 days
- Continue for 4-6 weeks minimum
Natural Treatment Methods
Beneficial Nematodes
Microscopic worms that parasitize gnat larvae:
Application:
- Purchase Steinernema feltiae nematodes
- Mix with dechlorinated water per package directions
- Apply to soil surface in evening
- Keep soil moist for 2 weeks
Nematodes are terrarium-safe and will not harm plants or other beneficial organisms.
BTI (Bacillus thuringiensis israelensis)
A bacteria that kills larvae when ingested:
Using Mosquito Dunks:
- Break off a small piece (1/4 of a dunk)
- Dissolve in 1 gallon of water overnight
- Use this water for your next watering
- Repeat weekly for 4 weeks
BTI is non-toxic to plants, animals, and beneficial insects.
Hydrogen Peroxide Drench
A more aggressive option for severe infestations:
Method:
- Mix 1 part 3% hydrogen peroxide with 4 parts water
- Allow soil to dry slightly first
- Water thoroughly with the mixture
- Fizzing indicates organic matter breakdown
Caution: This can harm sensitive moss and may temporarily shock plants. Use only for severe cases.
The Bioactive Solution
The most effective long-term prevention is creating a bioactive terrarium with natural predators.
Springtails
These tiny arthropods outcompete gnat larvae for food:
- Eat decaying matter before gnats can use it
- Reproduce quickly in terrarium conditions
- Completely harmless to plants
- Add 50-100 per small terrarium
Predatory Mites (Hypoaspis miles)
Actively hunt gnat larvae in soil:
- Effective in closed terrariums
- Self-sustaining population
- Also control other soil pests
- Add according to package directions
Prevention Strategies
Before Building
- Sterilize soil - Bake at 180°F for 30 minutes
- Quarantine plants - Isolate new plants for 2 weeks
- Inspect moss - Check for larvae before adding
- Use quality materials - Avoid garden soil
Ongoing Maintenance
- Avoid overwatering
- Remove dead plant material promptly
- Maintain proper ventilation schedule
- Introduce springtails as standard practice
When to Start Over
Consider rebuilding if:
- Infestation persists after 8+ weeks of treatment
- Multiple plants have died
- Soil smells foul or anaerobic
- You see significant root damage
Sometimes starting fresh with sterilized materials is more effective than continued treatment.
Treatment Timeline
| Week | Action | |------|--------| | 1 | Set up yellow sticky traps, reduce moisture | | 2 | Apply nematodes or BTI, continue trapping | | 3 | Second BTI application, monitor adult numbers | | 4 | Assess progress, add springtails for prevention | | 5-6 | Continue monitoring, traps should show fewer gnats | | 7-8 | Remove traps if clear, maintain preventive practices |
Conclusion
Fungus gnats are frustrating but entirely manageable. The key is patience and consistency, since you need to break their reproductive cycle completely. Once eliminated, adding springtails and maintaining proper moisture levels will prevent future infestations. Most terrarium keepers eventually establish a balance where gnats simply cannot gain a foothold.
Tags
Written by
Sarah Chen
A contributing writer at Terrarium Guide. Our team is dedicated to providing well-researched, accurate, and helpful content to our readers.
Learn more about our teamRelated Articles

Terrarium Condensation: How Much Is Too Much?
Learn to read condensation levels in your closed terrarium, when to ventilate, and how to achieve the perfect moisture balance.

Why Is My Terrarium Yellow? Common Causes and Fixes
Diagnose yellowing plants in your terrarium with this troubleshooting guide covering overwatering, light issues, nutrient deficiency, and more.

Terrarium Mold: How to Prevent, Identify, and Treat Fungal Growth
Mold is the most common terrarium problem. Learn to identify different types of fungal growth, understand what causes mold, and discover proven methods to treat and prevent it.