How to stop your computer from sleeping in Windows 11
In short
- Open Settings > System > Power & battery > Screen, sleep, & hibernate timeouts and set "Make my device sleep after" to Never for plugged in.
- On a laptop, also set "When I close the lid" to Do nothing for plugged in (Control Panel > Choose what the power buttons do).
- One command does the same: powercfg /change standby-timeout-ac 0. To keep it awake only for a while, Microsoft PowerToys Awake does it without changing your settings.
- Still sleeping? Run powercfg /requests and powercfg /lastwake to see what is in play.
To stop your computer from sleeping in Windows 11, open Settings > System > Power & battery > Screen, sleep, & hibernate timeouts and set Make my device sleep after to Never for Plugged in. On a laptop, also change what closing the lid does. The screen can still turn off; downloads, uploads and background apps keep running.
Windows 11 recently made its defaults stricter. Microsoft's own page lists a plugged-in device going to sleep after 5 minutes on modern standby devices and 15 minutes on older (S3) devices (Microsoft: power and sleep settings). So a PC that used to stay awake may now go to sleep in the middle of a long job.
Step 1. Set sleep to Never
- Press Start, open Settings.
- Go to System > Power & battery.
- Expand Screen, sleep, & hibernate timeouts.
- Set Make my device sleep after to Never for Plugged in.
- If you see a hibernate timer, set the plugged-in one to Never as well.
- Leave Turn my screen off after at a few minutes. A dark screen does not stop anything and saves power.
On battery, you can keep a short sleep timer, so the laptop does not drain if you unplug it.
Step 2. Laptop: change what closing the lid does
Microsoft's documented path is in Control Panel (Microsoft: shut down, sleep, or hibernate):
- Search the taskbar for Control Panel and open it.
- Select System and Security.
- Under Power Options, select Choose what the power buttons do.
- Select Change settings that are currently unavailable.
- In When I close the lid, set the Plugged in column to Do nothing.
- Select Save changes.
A closed laptop runs warmer. Put it on a desk, not a bed or sofa, and leave room for air.
Step 3 (optional). Do it with commands
Open Command Prompt or PowerShell as administrator and run the lines you need. All of them come from Microsoft's powercfg reference:
powercfg /change standby-timeout-ac 0
powercfg /change hibernate-timeout-ac 0
powercfg /change monitor-timeout-ac 10
The values are minutes. For the sleep timer, Microsoft documents 0 as "Never idle to sleep". The -ac settings apply when plugged in; use -dc for battery.
For the lid, while plugged in:
powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 0
powercfg /setactive SCHEME_CURRENT
LIDACTION 0 means Do Nothing (1 is Sleep, 2 Hibernate, 3 Shut Down), per Microsoft's lid close action page. powercfg /aliases lists the short names such as SCHEME_CURRENT and SUB_BUTTONS.
Commands help when you set up several PCs, say the five front-desk machines in a small accounting firm in Leeds, and want them all the same.
Only for a few hours: PowerToys Awake
If you just want the PC awake through a long download or render, without touching your settings, use Awake from Microsoft PowerToys. It can keep the PC awake indefinitely, for a set time or until a set moment, and it does not change your power plan. When you close it, the normal settings come back. Two limits from Microsoft's Awake page: it works only while you are signed in, and by default the display still turns off.
Still going to sleep? Find out why
Run these in an administrator Command Prompt:
powercfg /requestslists the apps and drivers that are asking Windows to stay awake right now. Useful to confirm your setting or a tool such as Awake is working.powercfg /lastwakeshows what woke the PC last time, for when it wakes up by itself.
Then check the usual causes, in this order:
- The lid was closed while on battery, or the lid setting was changed only for battery.
- A hibernate timer is still set.
- You changed the screen timer instead of the sleep timer.
- It is a work computer and a company policy overrides your choice. Ask IT.
If the PC has to stay on around the clock
For a PC that runs as a small server, or hosts a personal AI assistant that answers while you are away, three more settings matter.
Updates without surprise restarts. In Settings > Windows Update > Advanced options > Active hours, set the hours you need the PC most. Windows avoids restarting during those hours (Microsoft: active hours). Keep updates on.
Power comes back, PC comes back. A desktop PC can start by itself when power returns, but the switch is in the BIOS/UEFI, not in Windows. Its name depends on the maker; look for something like "AC power recovery" or "Restore on AC power loss" and set it to power on. A laptop rides out short cuts on its battery.
Sign in by itself. Apps you start yourself run only after you sign in. Microsoft's Sysinternals Autologon tool sets up automatic sign-in and stores the password encrypted in the registry. Anyone who switches the PC on then lands in your account, and disk encryption does not change that, because the PC unlocks and signs in by itself. Do this only on a machine in a locked room or a safe place at home.
Test it: leave the PC plugged in and untouched for an hour, then use whatever it is running. If it answers, the settings hold. If you are setting up Claude Code on this machine, the steps are in install Claude Code on Windows; for a Mac, see how to stop a Mac from sleeping.
Once your Windows machine stays awake and you move on to Claude Code or an assistant, you are welcome to join Team of One on WhatsApp. I run this free community for solo builders learning to expand what one person can handle with AI.
Checked on 18 November 2026 against Microsoft Support and Microsoft Learn.
Questions
How do I keep my computer from going to sleep without admin rights?
The Settings route (Power & battery > Screen, sleep, & hibernate timeouts) works for your own account. On a work laptop, your IT department may lock these settings; ask them before you try to get around it.
How do I stop my laptop from sleeping when I close the lid?
Open Control Panel > System and Security > Choose what the power buttons do, and set "When I close the lid" to Do nothing in the Plugged in column. Keep Sleep for On battery so it does not drain in a bag.
Is there a command to stop Windows from sleeping?
Yes. In Command Prompt or PowerShell, powercfg /change standby-timeout-ac 0 sets sleep to Never while plugged in. Use standby-timeout-dc 0 for battery.
How do I keep my PC awake for just a few hours?
Microsoft PowerToys includes Awake, which keeps the PC awake for a set time or until you turn it off, without changing your power plan.
Why does my PC still go to sleep after I set it to Never?
Check the lid setting, the hibernate timer and any policy set by your IT department. powercfg /requests shows what is holding the PC awake, and powercfg /lastwake shows what woke it last.
Sources
- Microsoft Support: How to adjust power and sleep settings in Windows: Settings > System > Power & battery > Screen, sleep, & hibernate timeouts; new defaults, checked 18 November 2026
- Microsoft Support: Shut down, sleep, or hibernate your PC: Control Panel > System and Security > Choose what the power buttons do > When I close the lid, checked 18 November 2026
- Microsoft Learn: Powercfg command-line options: /change (standby-timeout-ac, hibernate-timeout-ac, monitor-timeout-ac, in minutes), /setacvalueindex, /setactive, /aliases, /requests, /lastwake, checked 18 November 2026
- Microsoft Learn: Sleep idle timeout (STANDBYIDLE): 0 = Never idle to sleep, checked 18 November 2026
- Microsoft Learn: Lid switch close action (LIDACTION): 0 Do Nothing, 1 Sleep, 2 Hibernate, 3 Shut Down, checked 18 November 2026
- Microsoft Learn: PowerToys Awake keeps the PC awake without changing power plan settings; display turns off by default; only while signed in, checked 18 November 2026
- Microsoft Support: Keep your PC up to date with active hours: Windows avoids restarts during active hours, checked 18 November 2026
- Microsoft Learn: Sysinternals Autologon v3.10: configures automatic sign-in; the password is stored encrypted in the registry as an LSA secret, checked 18 November 2026
Free WhatsApp community
Learning AI? Learn it on real work.
In “Team of one” I post what I actually tried on my own work. Most of it is in Romanian, but ask in English any time and we will work it out together.
Join the community