If you’re like many internet users today, being on a computer—checking Facebook on your smart phone or watching Netflix on your laptop—may be the last thing you do at night before you fall asleep. But do you also find that you tend to stay up too late, have trouble falling asleep, or wake up unaccountably restless? It’s no coincidence: scientists agree that light from your computer or mobile phone can keep you up at night, seriously disrupting your sleep schedule. We talked to Richard Stevens, a medical researcher at the University of Connecticut, and he explained why.

Your Internal Clock

According to Stevens, to understand why light from your computer can affect how you sleep, you first need to understand how your body keeps time. Stevens explains that your body keeps an internal clock which regulates everything “from your core body temperature, to when to release hormones like melatonin,” the chemical which readies your body for sleep, he says. If you’ve ever struggled futilely against jet-lag, you know just how much power your body’s internal clock has.

Simply put, your internal clock works like this: a part of your brain (called the suprachiasmatic nucleus) coordinates your internal timing, telling different parts of your body how and when to act, “much like the conductor of an orchestra,” Stevens says. This bit of brain functions by sending electrical signals and chemicals through groups of cells at an ever-punctual, roughly 24-hour rhythm.

“Now you could take a person, put them in a dark room with absolutely no clues as to what time it is outside, and for the rest of their life that person would sleep and wake up on essentially a 24 hour cycle” thanks to that internal clock, says Stevens. But that doesn’t mean our internal clocks are perfectly timed. Although it changes from person to person, on average, your internal clock is about 12 minutes off.

So, to make sure your body is in tune with Earth’s natural day/night cycle (after a few weeks, 12 minute daily changes would really add up) your body has to constantly take cues from your surroundings, and use that info to realign your clock. And this is where your computer comes in.

Blue Light

One of the biggest cues our bodies use to adjust our internal clocks is light.

According to Stevens, in the late 1990s, scientists discovered that our eyes have special cells that register light, but unlike the cells around them, don’t contribute to our vision. Instead, these cells directly transmit information about whether or not they’re seeing light to that bit of brain that controls your internal clock, the suprachiasmatic nucleus. With that information about the light outside, your suprachiasmatic nucleus helps shift your internal clock forward or backward.

Now not all light is equal to your internal clock. The special cells in your eyes particularly respond to one color of light: blue. (Scientifically speaking, it’s light with a wavelength between 460 to 480 nanometers.) One theory as to why your brain uses blue light to adjust itself is that blue is the strongest color in early morning sunlight—and can tell your brain when the day has started.

On the other end of the spectrum: the light that comes from sources like a campfire has almost no blue light in it, and has almost no effect on your internal clock.

The issue with your computer is that is essentially blasts your eyeballs with mostly blue light. Have you ever noticed how a dark room with a computer or TV on glows a soft, pale blue? That’s because the various screens on our TVs and computers primarily emit that color.

Stevens says that when we sit in front of our computer screens at night, we’re essentially sending the message to our internal clock that: ‘Hey, there’s lots of bright blue light out here, it must still be daytime,’ and over time, we’re pushing our internal clock farther and farther backwards and out of sync. “That prevents your body from going into its sleep mode at the right time,” says Stevens, which “prevents you from getting sleepy,” and causes you to mistime your production of melatonin. Over time, the effect can be dramatic and is often confused with mild insomnia.

And how much our internal clocks are misadjusted by the light we get from our computers can vary greatly, says Stevens. If, for example, your computer is extra bright, or if you have your laptop right in front of your face in bed, you’re maximizing the issue.

Stevens admits that exactly what long-term health effect this unnatural light-driven issue has on your body is still unknown, and (quite frankly) is a rather contentious and unclear frontier for scientists. But scientists worldwide agree, he says, that the short-term effects are clear: By misadjusting your internal clock, computer-driven light inhibits good, restful sleep, and makes waking up more difficult in the morning. And deep, restful sleep is now widely understood to be a crucial component to good health, says Stevens.

So What Can You Do?

The best possible solution, Stevens says, is to ensure that you’re not using computers, bright lights, or gadgets that are blasting your face with bright, blue light right before bed. He recommends you reduce your computer usage in the evening, and certainly don’t use it right before bed.

When this isn’t an option, there are ways to mitigate the harm. “Dim your computer to the lowest setting that’s comfortable,” Stevens says, who also recommends programs like f.lux, which adjust your computer or smart phone screen to produce less blue light in the evening. This won’t entirely fix the issue, especially if the screen is close to your face, but it’ll help.

There are other steps you can take. Alongside limiting your intake of bright blue light at night, you can help give your internal clock the right clues when it needs them—as soon as you wake up. In the morning, open your windows, and try to soak in as much sunlight as possible. This helps your internal clock scoot back to where it belongs.