Yes, gnats are attracted to light, which is why you’ll often find them swarming around porch lights, lamps, and windows. But the reason isn’t what most people assume. Gnats aren’t flying toward light because they “want” it. Instead, artificial light disrupts a basic navigation system that insects have relied on for hundreds of millions of years.
Why Gnats Fly Toward Light
For most of insect evolutionary history, the brightest thing in the visual field was always the sky. Flying insects use this fact to stay upright: they keep their back (dorsal side) tilted toward the brightest region above them. This is called the dorsal light response, and it works perfectly under the sun, moon, and stars because those light sources are so far away that their position never changes relative to the insect.
Artificial lights break this system. When a bright bulb is nearby rather than millions of miles away, an insect tilting its back toward the light doesn’t just stay upright. It ends up banking, turning, and circling continuously around the source. A 2023 study using motion-capture technology confirmed this by tracking multiple insect species around light sources. The insects consistently tilted their backs toward the light with a strong directional index of around 0.80 to 0.84, meaning their orientation was almost entirely dictated by the light’s position. With the light off, that consistency dropped to 0.17, essentially random.
This means gnats aren’t navigating to the light or trying to escape through it. They rarely fly straight at it. Instead, they fly perpendicular to it, orbiting in tight loops because their body keeps tilting toward a “sky” that’s actually a bulb three feet away. They’re trapped by a sensory glitch, not drawn by attraction in the way we usually think of it.
Which Gnats Are Most Affected
The term “gnat” covers several different small flies, and most of them respond to light, though their overall behavior differs.
Fungus gnats, the tiny dark flies that breed in the moist soil of houseplants, are reliably attracted to light. Indoors, you’ll typically notice them first near windows because they gravitate toward the brightest spot in the room. They also respond well to yellow sticky traps, which exploit their visual attraction.
Biting midges (sometimes called no-see-ums) and drain flies also respond to light, though moisture, carbon dioxide from your breath, and organic matter play a larger role in guiding them to food and breeding sites. For these species, light is one attractant among several, not the primary one. A gnat buzzing around your face at a barbecue is likely following your CO2 plume and body heat more than any nearby lamp.
Light Color Matters More Than Brightness
Not all light wavelengths attract gnats equally. A UCLA-affiliated study on outdoor lighting found that blue and ultraviolet light draw significantly more flying insects than warmer colors. Yellow and amber LED light attracted far fewer insects in comparison. This lines up with the dorsal light response: shorter wavelengths (blue, UV) more closely mimic the sky’s natural light signature, making them stronger triggers for the navigation glitch that traps insects.
Cool-white LEDs, which contain a large spike of blue wavelength light, are particularly problematic. Standard “daylight” bulbs fall into this category. Swapping them for warm amber or yellow-filtered LEDs on porches and patios can noticeably reduce the cloud of gnats and other small flies that gather around your outdoor lights in the evening.
Using Light To Control Gnats Indoors
Since gnats reliably orient toward light, you can use that behavior against them. Yellow sticky traps placed near windows or next to houseplants catch adult fungus gnats effectively. You can cut standard sticky traps into smaller pieces and attach them to wooden skewers stuck into potted soil, placing them right where the adults emerge.
UV light traps (the plug-in kind with a glowing blue light and a sticky or electric grid) also work on gnats, though they’re better at reducing the visible adult population than solving the underlying problem. If fungus gnats are breeding in your houseplant soil, trapping adults near a light won’t stop the larvae developing in the dirt. Letting the top inch or two of soil dry out between waterings eliminates the moist conditions larvae need to survive, which addresses the source rather than just the symptom.
How To Reduce Gnats Around Outdoor Lights
A few straightforward changes to your outdoor lighting can cut down on gnat swarms significantly:
- Switch to amber or yellow LEDs. These wavelengths attract far fewer flying insects than white or blue-toned bulbs.
- Use the minimum brightness you need. Dimmer lights draw fewer insects than bright ones.
- Turn lights off when not in use. Timed or motion-activated fixtures eliminate hours of unnecessary insect attraction each night.
- Position lights away from doors and seating areas. If a light must stay on, placing it at the perimeter of your yard pulls the swarm away from where you spend time.
These steps won’t eliminate every gnat, especially species that follow moisture and CO2 rather than light. But for the large number of small flies that end up circling your porch light on a summer evening, switching from a cool-white bulb to a warm amber one is the single most effective change you can make.