Skip to content
Follow
Windows 🟡 Intermediate

How to Automatically Lock Computer after Inactivity in Windows 11

Richard
Written by
Richard
Feb 17, 2026 Updated Jul 30, 2026 9 min read
How to Enable or Disable Automatic Lock on Your Windows 11 PC
How to Enable or Disable Automatic Lock on Your Windows 11 PC

Windows 11 can automatically lock your computer after a period of inactivity, preventing unauthorized access.

This feature acts like a digital lock that secures your PC when you step away, adding a layer of security without you needing to manually lock it each time.

For example, you can set your PC to lock after just 5 minutes of no keyboard or mouse activity.

This article shows you how to set this up using two simple methods.

⚡ Quick Answer

Control automatic PC locking in Windows 11 via Power & Sleep settings or Local Security Policy/Registry Editor. Adjust inactivity time in seconds or set to 0 to disable.

Why Lock Your PC Automatically?

Locking your Windows 11 PC automatically adds a crucial layer of security, keeping your files and personal information safe from anyone who might see them when you're not there. This simple step ensures your data remains private even if you step away for a moment.

When your computer is locked, you’ll see the lock screen. You simply need to enter your password or PIN to get back to where you were. Everything you had open will still be there, ready for you. This is helpful because you don’t have to close all your apps and start over.

This feature is great if you work in a shared office, have kids at home, or just want extra peace of mind knowing your digital information is protected. We'll explain how to choose how long Windows waits before locking.

Method 1Using the Local Security Policy Editor (🪟 Windows 11 Pro, Enterprise, and Education)

The Local Security Policy editor offers a straightforward way to set up Windows 11 automatic lock for Windows 11 Pro, Enterprise, and Education users. This tool lets you easily adjust security settings without needing complex commands, making the Local Security Policy editor the preferred method if your Windows 11 edition supports it.

This method does not work on Windows 11 Home. If you have the Home edition, use Method 2, which involves the Registry Editor.

Step 1Open the Local Security Policy Editor

Opening the Local Security Policy editor is simple and starts from your Start menu. Type 'secpol.msc' into the search bar and click on 'Local Security Policy' when it appears to launch the tool for managing your PC's security settings.

  • Click the Start button.
  • Type secpol.msc into the search bar.
  • Click on "Local Security Policy" when it shows up in the search results.
open local security policy editor
open local security policy editor

The Security Settings window opens to show all options. You only need to change one setting to automatically lock your computer after inactivity.

Step 2Go to Security Options

Within the Local Security Policy window, you need to locate the 'Security Options' to find the setting for automatic PC locking. On the left side, double-click 'Local Policies,' then click on 'Security Options' to reveal the list of detailed security settings on the right.

  • In the left side of the Local Security Policy window, you'll see categories. Double-click "Local Policies" to open it.
  • After opening "Local Policies," click on "Security Options." This will show a list of detailed security settings on the right side.
Windows 11 security options in Local Security Policy Editor.
Windows 11 security options in Local Security Policy Editor.

Take your time to ensure you click the correct option.

Step 3Find the Inactivity Limit Setting

The key setting to control Windows 11 automatic lock is called 'Interactive logon: Machine inactivity limit.' Scroll through the list on the right side of the Security Options and double-click this specific setting to open its properties and adjust the inactivity timeout.

  • On the right side, scroll down until you see "Interactive logon: Machine inactivity limit".
  • Double-click this setting to open its properties.
Setting machine inactivity lock time in Windows security policy.
Setting machine inactivity lock time in Windows security policy.

The inactivity timer is where you set how long Windows waits before locking your computer. If you haven't changed this setting before, it's likely set to 0, which means your computer won't lock automatically.

Step 4Set Your Desired Inactivity Time

In the properties window for 'Interactive logon: Machine inactivity limit,' you can set your desired inactivity time for Windows 11 automatic lock. Enter the number of seconds you want your PC to wait before locking; setting it to 0 turns off the automatic lock feature.

  • In the properties window that opened, you'll see a box to enter a number.
  • Enter the number of seconds you want your computer to wait before locking automatically.

Here's how to interpret the numbers:

  • To turn OFF automatic locking: Set the value to 0. This is the default.
  • To turn ON automatic locking: Enter any number higher than 0.

Calculation Tip:

  • For 5 minutes of inactivity: 5 minutes * 60 seconds/minute = 300 seconds.
  • For 15 minutes of inactivity: 15 minutes * 60 seconds/minute = 900 seconds.

The longest duration you can set is 599940 seconds (which is almost 7 days).

Configuring interactive logon machine inactivity timeout in Windows 11.
Configuring interactive logon machine inactivity timeout in Windows 11.
  • Once you've entered your number, click the "OK" button.

Step 5Close and Restart

After setting your desired inactivity time, close the Local Security Policy window and restart your computer to apply the Windows 11 automatic lock setting. This restart is essential for the new timeout duration to take effect and start locking your PC automatically.

  • Close the Local Security Policy window.
  • Restart your computer. This is important for the new setting to work.

After your computer restarts, it will begin locking itself based on the time you configured. Try stepping away from your PC for longer than your chosen duration to verify it locks!

Method 2Using the Registry Editor (All 🪟 Windows 11 Editions)

If you have Windows 11 Home, you can set up an automatic lock using the Registry Editor, which works on all Windows 11 editions. While powerful, this method requires careful editing of system settings, so proceed with caution to avoid unintended system issues.

Modifying the Windows Registry incorrectly can cause severe problems, potentially requiring a Windows reinstallation. It is highly recommended to back up your registry before proceeding with registry changes. If you are not comfortable with registry modification steps, seek assistance from a knowledgeable individual or utilize Method 1 if it is an option.

Step 1Open the Registry Editor

To begin setting up Windows 11 automatic lock via the registry, open the Registry Editor by clicking the Start button, typing 'regedit,' and selecting 'Registry Editor' from the search results. You'll need to confirm a User Account Control prompt to proceed.

  • Click the Start button.
  • Type regedit into the search bar.
  • Click on "Registry Editor" when it appears in the search results.

You'll likely see a User Account Control prompt asking for permission to allow this app to make changes. Click "Yes".

The Registry Editor window opens and displays your system's registry in a structured list of folders, allowing you to change settings.

Step 2Go to the Correct Registry Key

Navigate carefully to the correct registry key for setting the inactivity timeout on Windows 11. Expand the folders in order: HKEY_LOCAL_MACHINE, then SOFTWARE, Microsoft, Windows, CurrentVersion, and finally click on the Policies folder to locate the relevant settings.

  • In the left side of the Registry Editor, you'll see folders. Go to this path:
  • Expand HKEY_LOCAL_MACHINE.
  • Then expand SOFTWARE.
  • Then expand Microsoft.
  • Then expand Windows.
  • Then expand CurrentVersion.
  • Finally, click on the Policies folder.
  • Inside the Policies folder, click on the System folder.

The full path you should see on the left is: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

Ensure you click on the System folder itself, so its contents are displayed on the right pane.

Step 3Find or Create the "InactivityTimeoutSecs" Value

In the right pane of the Registry Editor, look for a value named 'InactivityTimeoutSecs' to set your Windows 11 automatic lock time. If it doesn't exist, right-click in the empty space, select 'New,' then 'DWORD (32-bit) Value,' and name it 'InactivityTimeoutSecs.'

  • Look for a value named InactivityTimeoutSecs.
  • If you find it, double-click it to change it.
  • If you don't find it: You need to create it.
    • Right-click on an empty space on the right side.
    • Hover over "New".
    • Click on "DWORD (32-bit) Value".
    • When asked to name the new value, type exactly InactivityTimeoutSecs and press Enter.
  • Next, double-click on the InactivityTimeoutSecs value that you either created or located to modify it.

This value type, "DWORD (32-bit) Value," is standard for such configurations.

Step 4Set the Timeout in Seconds

To set the inactivity timeout for Windows 11 automatic lock, double-click the 'InactivityTimeoutSecs' value and enter your desired duration in seconds in the 'Value data' box, ensuring 'Decimal' is selected. A value of 0 will disable the automatic lock.

  • In the "Edit DWORD (32-bit) Value" window, you'll see "Base."
  • Make sure "Decimal" is selected (it usually is by default).
  • In the "Value data" box, enter the number of seconds you want to wait before your PC locks automatically.

Keep these numbers in mind:

  • Enter 0 to disable automatic locking.
  • Enter a number higher than 0 to enable it. For example, 300 for 5 minutes, or 900 for 15 minutes.

The maximum setting available is 599940 seconds.

  • Once you've entered your number, click "OK".

Step 5Close and Restart

You will finalize your changes to allow Windows 11 to implement them by restarting your computer. Restarting your computer ensures that all the new settings you configured take effect, so your computer locks automatically after a period of inactivity.

  • Close the Registry Editor window.
  • Restart your computer. This is needed for the registry changes to work.

Following the restart, your computer will commence locking itself after the predetermined time you've set.

What About Presence Sensors? (Walk Away Lock)

Some modern laptops have 'presence sensors' that can automatically lock your Windows 11 PC when you walk away. If your device supports this, you might find a 'Walk away lock' option in your Windows Settings or manufacturer's software, offering a convenient way to secure your computer.

The automatic PC locking feature locks your computer when a sensor detects your absence for a set time. This advanced security method secures your PC. The specific location and function of these settings can differ greatly by device. Consult your device's manual for more details.

This mechanism differs from the inactivity timeout previously discussed, as it relies on physical presence detection rather than solely monitoring keyboard or mouse activity.

Summary

Securing your Windows 11 PC when you step away is easy with automatic locking, enhancing data protection without manual effort. You can set up Windows 11 automatic lock using the Local Security Policy editor on Pro/Enterprise/Education editions or by carefully editing the Registry Editor on any Windows 11 version.

You can utilize the Local Security Policy editor (if you have Windows 11 Pro, Enterprise, or Education) or carefully edit the Registry Editor on any Windows 11 version. You can adjust the inactivity time to suit your preferences. Select a duration that balances security needs with convenience for your daily workflow.0regedit.exe300900

How long should your laptop be inactive before it automatically locks itself?

High-risk, public-facing, or clinical areas: 1–3 minutes for screen lock. Standard office environments: 5–10 minutes for screen lock. Shared or kiosk-style workstations: 1–3 minutes for screen lock plus rapid re-auth workflows. Application/EHR session timeout: 10–15 minutes of inactivity before logout.

Was this guide helpful?

100% of readers found this helpful (2 votes)

Tags: #Windows 11
Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Reset Group Policy Windows 11 to Default
Windows How to Reset Group Policy Windows 11 to Default
How to Lock Your Windows 11 Computer
Windows How to Lock Your Windows 11 Computer
How to Turn On or Off the Lock Screen in Windows 11
Windows How to Turn On or Off the Lock Screen in Windows 11
How to Enable or Disable Lock Screen Background in Windows 11
Windows How to Enable or Disable Lock Screen Background in Windows 11

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *