Caffeine for Windows: how it works, and the alternatives

Caffeine keeps Windows awake by faking an F15 keypress every 59 seconds. Its useful switches, the catch, and alternatives that do not simulate input.

Caffeine for Windows is a small tray utility from Zhorn Software that stops your PC from sleeping or locking by pretending you pressed a key. That trick is also its catch. Here is how it works, the options worth knowing, and the alternatives that keep Windows awake without simulating input.

How Caffeine works

By default, Caffeine simulates a press of the F15 key every 59 seconds. Few keyboards have an F15, so you never see it, but Windows counts it as activity: the screen saver does not start, the session does not lock, and the PC does not sleep. It comes as a zip with 32-bit and 64-bit builds and sits in the system tray, where a click turns it on or off.

Because it is real input as far as Windows is concerned, apps that watch for keyboard activity can see it too. Its author warns that F15 can cause problems in some programs, naming PuTTY, PowerPoint, Google Docs and Smartsheet. If that bites you, switches like -useshift or -key:xx change the key, and -stes stops simulating keys altogether.

The command-line switches worth knowing

  • -stes: keep Windows awake through the system’s power request instead of a fake key.
  • -allowss: keep the PC awake but let the screen saver start.
  • -onac: only while plugged in.
  • -watchwindow:xx: only while a window with xx in its title exists.
  • -activeperiods:0900-1659: only during those hours.
  • -cpu:xx: stay active until CPU use drops below that percentage.
  • -exitafter:xx and -activefor:xx: stop after that many minutes.
  • -notwhenlocked: go inactive when you lock the PC.

The full list is on Zhorn’s Caffeine page.

Keypress or power request: which one you want

There are two ways to keep Windows awake, and they behave differently:

Simulated keypressPower request
Who does it Caffeine (default) Caffeine with -stes, PowerToys Awake, Keep Awake
PC stays awake Yes Yes
Session lock and screen saver Held off, since Windows sees activity Follow your normal settings
Apps can see “activity” Yes, it is input No, nothing is typed
Side effects in other apps Possible (see above) None from input

If the job is to keep a download, a render or a remote session going, a power request is enough and cleaner. If you need the PC to behave as if someone is at the keyboard, that is what a keypress is for, with its trade-offs.

The alternatives

PowerToys Awake

Microsoft’s free PowerToys include Awake: keep the PC awake indefinitely, for an interval, or until a date and time, optionally with the screen on, without changing your power plan. From the command line, --pid keeps it awake until a given process ends. Each mode, with its Mac equivalent, is in our PowerToys Awake for Mac guide.

Windows settings

Settings > System > Power & battery > Screen, sleep, & hibernate timeouts: set sleep to Never. It works, but it stays that way until you change it back.

Keep Awake

Disclosure: this one is ours. Keep Awake is built into Webstarted Toolbox, a free tray app for Windows 10 and later (and macOS 12 and later). It uses the Windows power request, so it does not type anything:

  • 30 minutes to 8 hours, any other length or a clock time with “Other…”, or until you turn it off.
  • “While a process runs”: give it a process name (not a window title) and the PC stays awake while that process runs.
  • “Only when plugged in”, like -onac.
  • Turn the screens off after 5 to 30 idle minutes, optionally locking the session first, while the PC keeps working.
  • The same tool on a Mac, if you use both.

What it does not do: schedules by hour, a CPU threshold, or making you look active. For those, Caffeine is still the one.

Which one to use

  • You need the PC to look in use: Caffeine with its default keypress.
  • You already run PowerToys: Awake.
  • You want it tied to a process, or the same tool on Windows and Mac: Keep Awake.
  • You are leaving a job running with the screen off and the PC locked: our guide to keeping your computer awake while you are away.

Sources

Get Webstarted Toolbox

Keep Awake comes built into Toolbox: free, no account, Windows 10 and later and macOS 12 and later.

Free beta · macOS · Windows (x64) · Signed & notarized · No account required