The fastest way to close a window

Press Alt + F4 on Windows or Command + W on Mac. This closes the active window — the one you are currently using — instantly. On Windows, Alt + F4 also closes your entire application if only one window is open. On Mac, Command + W closes just that window and leaves the application running in the background.

If you want to close the application completely on Mac, use Command + Q instead. This shuts down the program entirely, not just the window.

These keyboard shortcuts work in almost every program: web browsers, text editors, file managers, email clients, and most other applications. They are faster than reaching for your mouse and clicking the X button in the corner.

Key Takeaways

  • Alt + F4 on Windows closes the active window, or the entire application if only one window is open.
  • Command + W on Mac closes the active window while keeping the application running.
  • Command + Q on Mac closes the entire application, not just the window.
  • These shortcuts work in nearly all programs and are faster than using your mouse.
  • If a window will not close, the application may be frozen and you may need to force-quit it instead.

Why keyboard shortcuts are faster than the mouse

Your hands are already on the keyboard when you are typing or working. Reaching for the mouse, moving it to the X button, and clicking takes several seconds. A keyboard shortcut takes less than a second and does not interrupt your workflow.

Keyboard shortcuts also work the same way across different programs. Once you memorize Alt + F4 or Command + W, you can close any window without thinking about it. You do not have to locate the close button, which can be in slightly different positions depending on the application.

What to do if Alt + F4 or Command + W does not work

Some applications override these standard shortcuts for their own purposes. For example, a video game might use Alt + F4 as a gameplay command instead of a close command. In these cases, you will need to use the close button in the window's title bar or look in the application's menu for a "Close" or "Exit" option.

If a window is frozen and will not respond to any keyboard command, you may need to force-quit the application. On Windows, press Ctrl + Alt + Delete, select the frozen application from the list, and click "End Task". On Mac, press Command + Option + Escape, select the frozen application, and click "Force Quit".

Closing multiple windows at once

If you have many windows open in the same application and want to close them all, use Alt + F4 repeatedly on Windows or Command + W repeatedly on Mac. Each press closes one window. This is faster than clicking the X button on each window individually.

On Windows, if you want to close the entire application and all its windows at once, Alt + F4 will do that after you close the last window. On Mac, use Command + Q to close the application and all its windows immediately.

Closing windows in web browsers

Web browsers follow the same rules. Alt + F4 on Windows closes the current tab and the browser if it is the last tab, or closes the entire browser if you press it again. Command + W on Mac closes the current tab. Command + Q closes the entire browser.

If you want to close only the current tab without closing the window, use Ctrl + W on Windows or Command + W on Mac. This is useful when you have multiple tabs open and want to keep the browser window open.

Keyboard shortcuts for other window actions

Beyond closing, keyboard shortcuts can help you manage windows more efficiently. Alt + Tab on Windows or Command + Tab on Mac switches between open applications. Windows Key + Left Arrow on Windows snaps a window to the left half of your screen, and Windows Key + Right Arrow snaps it to the right half.

On Mac, you can use Mission Control by pressing F3 or Control + Up Arrow to see all open windows at once. This makes it easy to find and click on the window you want without using Alt + Tab repeatedly.

Frequently Asked Questions

Does Alt + F4 save my work before closing?

No. Alt + F4 closes the window immediately without saving. If you have unsaved work, most applications will show a dialog asking if you want to save before closing. Click "Save" or "Don't Save" as needed. Always save your work manually before closing if you are unsure whether the application will prompt you.

Can I undo closing a window?

Not directly. Once a window is closed, it is gone. However, many applications like web browsers and text editors can reopen recently closed windows. In most browsers, press Ctrl + Shift + T on Windows or Command + Shift + T on Mac to reopen the last closed tab.

What is the difference between closing a window and closing an application?

Closing a window closes one specific window, but the application may still be running in the background. Closing an application shuts down the entire program. On Mac, this distinction is important because applications often keep running after you close their windows.

Why does Alt + F4 sometimes close my entire computer instead of just a window?

This usually happens if you are on your desktop or in File Explorer with no application window active. Alt + F4 then closes the desktop environment or File Explorer. To avoid this, make sure you have an application window selected before pressing Alt + F4.

Can I customize these keyboard shortcuts?

On Windows, customizing system shortcuts is difficult and not recommended. On Mac, you can create custom shortcuts in System Preferences under Keyboard, but changing standard shortcuts like Command + W may cause problems. It is better to learn the standard shortcuts, which work the same way across all your devices.