Our Privacy/Cookie Policy contains detailed information about the types of cookies & related technology on our site, and some ways to opt out. By using the site, you agree to the uses of cookies and other technology as outlined in our Policy, and to our Terms of Use.


Fruit Gnats in Hermit Crab Habitats

i Brand X Pictures/Brand X Pictures/Getty Images

Insects might be distant relatives of hermit crabs - they both belong to the arthropod phylum - but that does not mean that gnats or flies make a good addition to the hermit crab tank. If you open the tank, and a swarm of tiny flies comes out, you have a problem.

Fruit Flies or Fungus Gnats?

There are two groups of tiny flies that you might refer to as “fruit gnats” and either could infest a terrarium. Fruit flies, as the name suggests, are especially attracted to decaying fruit while the larvae of fungus gnats feed on fungi in the soil. Both groups are tiny but fruit flies have stouter, more rounded bodies whereas fungus gnats are thin and their bodies pure black. There are numerous different species of both but, unless you are an entomologist, it’s unlikely you’ll be able to make that precise an identification. The important thing with regards to hermit crabs is that fungus gnats especially might be indicative of a more serious problem.

What Attracts Them to A Hermit Crab Tank?

The primary attraction for fruit flies is uneaten fresh fruit and vegetables, especially once that food begins to decay. As it is necessary to keep a hermit crab tank warm and very humid, leftover food will start rotting within hours, providing the perfect meal for fruit flies and their larvae. Damp, rarely changed substrate allows fungus to spread, which may attract fungus gnats. The flies may get in to the tank through ventilation holes or just when you lift the lid to feed your crabs.

Potential Problems

The problem isn’t so much the flies themselves. Although you might find them irritating, they are harmless to hermit crabs, not being able to bite or sting and rarely spreading disease. These flies are more an indication of conditions in the tank not being healthy overall. If there are fruit flies, there might also be an abundance of fungi and bacteria, which could cause serious problems to the crabs. Fungus gnats suggest strongly that the tank needs cleaning more frequently.


More frequent cleaning of the tank is crucial. Also, remove uneaten fresh food within an hour of feeding the crabs. A change of substrate might help. Potting compost and coconut fiber both provide the perfect environment for fruit flies and fungus gnats to multiply. Changing it to sand or crushed coral might deter the flies, especially if there is not much for them to feed on. Letting the tank become drier is not an option. It might work for houseplants but hermit crabs need humidity in order to breathe. Obviously, pesticides of any sort are out of the question. One alternative to pesticides, according to HermitCrabs.com, is dampening the substrate with a dilute saline solution, which is not toxic to hermit crabs but might discourage flies.