If you’re having trouble falling asleep at night or waking up in the morning, you’re not alone. According to the National Institute of Neurological Disorders and Stroke, about 40 million people in the United States suffer from chronic long-term sleep disorders each year and an additional 20 million people experience occasional sleep problems. Luckily, there are several apps available for Web, iOS, and Android users that can help you try to sleep a little better.

If you want help falling asleep, you can try an app that tells you exactly when you should go to sleep to make sure you’re rested by the time you’re supposed to wake up. Sleepyti.me is a Web app that can do exactly that. Just choose when you have to wake up and the app will tell you the best time to fall asleep. You can also use Sleepyti.me to find out what time is best to wake up if you went to bed right now. It works by calculating back (or forward) by sleep cycles, which are typically 90 minutes each.

Android, iOS and Web Apps to Help You Sleep BetterAnother Web app, Sleeptiming, is more focused on telling you when to wake up, but works very much the same way as Sleepyti.me. Just check the app when you’re ready to crawl into bed, and Sleeptiming will tell you what time to set the alarm for, assuming that it takes you 15 minutes to fall asleep (the average for most adults) and that you want 5-6 sleep cycles. If you know you need less sleep, or are required to wake up earlier, the app gives you alternative options based on your sleep cycles.

For iOS users, you can always try an app that automatically wakes you up based on your own sleep cycles. With Sleep Cycles — available in the iTunes App Store for $0.99 — you tell the app when you need to wake up, and then place your phone under your pillow while you sleep. Sleep Cycles will wake you up slowly at the point in your sleep cycling when you are sleeping lightest, but always before you need to wake up. Even if you can’t manage a full eight hours of sleep, Sleep Cycles can make waking up in the morning much easier. Android users can get a similar experience with apps like Gentle Alarm.

While these apps — and others — can encourage you to sleep and wake at certain times, the best way to get the sleep you need is to go to bed at a regular time every night and strive for eight hours.

Do you use an app to help you sleep? Let us know your favorites in the comments.