The fastest shortcut to close a window on Windows is Alt+F4. On a Mac, press Command+W to close the current window (or Command+Shift+W to close all windows of an app). These two shortcuts cover the vast majority of everyday cases, but the full picture includes a few more options depending on what you’re closing, your keyboard, and whether you want to close a tab, a dialog box, or the entire application.
Why Alt+F4 Works on Windows
Alt+F4 is a system-level shortcut that has existed since Windows 3.0 (1990). It sends a “close” command to the currently active window. The behavior depends on the context:
- If a normal app window (like a browser or file explorer) is focused, Alt+F4 closes that window entirely.
- If the desktop is focused (no window active), Alt+F4 opens the Windows shutdown dialog.
- If a dialog box (like a settings pop-up) is open, Alt+F4 closes that dialog, not the parent window.
Because it is handled by the operating system, Alt+F4 works even when an app’s own close button is missing or the window is frozen. It’s the closest thing to a universal “close this window” command on Windows.
The Mac Equivalent: Command+W vs Command+Q
On macOS, the shortcut Command+W closes the frontmost window of the active app. For example, in Safari it closes the current window (or tab if you’re using tabs). To close all windows of an app, use Command+Option+W. To quit the entire application, use Command+Q. Many Windows users transitioning to Mac mistakenly press Command+Q to close a window, which quits the app entirely—so remember: W for window, Q for quit.
Closing Tabs vs Windows in Browsers
In browsers like Chrome, Edge, Firefox, and Safari, a “window” can contain multiple tabs. The shortcuts differ:
- Close current tab: Ctrl+W (Windows) or Command+W (Mac).
- Close current window: Ctrl+Shift+W (Windows) or Command+Shift+W (Mac).
- Reopen the last closed tab: Ctrl+Shift+T (Windows) or Command+Shift+T (Mac).
- Reopen the last closed window: Ctrl+Shift+N (Windows, in Chrome/Edge) or Command+Shift+N (Mac, in Chrome).
Note that in some browsers, Ctrl+Shift+W closes the window, but in others (like Firefox) it closes the window too, but the exact behavior is consistent across major browsers. If you accidentally close a window, the reopen shortcut is your best friend.
How to Close a Window Without a Keyboard
If your keyboard is broken, or you’re using a touchscreen, there are mouse-only alternatives:
- Click the X button in the top-right corner (Windows) or top-left red button (Mac).
- On Windows, right-click the app’s icon in the taskbar and select “Close window” or “Close”.
- On Mac, right-click the app’s Dock icon and select “Quit” (closes all windows) or press Option+right-click to see “Force Quit”.
- Use the system menu: on Windows, press Alt+Space to open the window menu, then press C to close.
For touchscreens, swipe down from the top of the window (in some apps) or use the on-screen close button.
When Alt+F4 Doesn’t Work: Force Closing
If a window is unresponsive, Alt+F4 may do nothing because the app isn’t processing messages. In that case:
- Press Ctrl+Shift+Esc to open Task Manager (Windows).
- Find the app under “Processes” or “Apps”.
- Right-click it and select “End task”.
On a Mac, press Command+Option+Esc to open the Force Quit menu, select the app, and click “Force Quit”. Force closing can lose unsaved work, so only use it when the app is truly stuck.
Closing Windows in File Explorer and Other Apps
File Explorer (Windows) and Finder (Mac) follow the same shortcuts: Alt+F4 or Command+W. But some apps have their own shortcuts:
- Microsoft Office (Word, Excel, PowerPoint): Ctrl+W closes the document window, Alt+F4 closes the entire application.
- Photoshop: Ctrl+W closes the current image, Ctrl+Alt+W closes all images.
- Terminal (Windows Terminal): Ctrl+Shift+W closes the current tab, Alt+F4 closes the window.
- Remote Desktop: If you’re connected to a remote Windows machine, Alt+F4 might close the remote session’s window, not the local one—check your client settings.
Always check an app’s menu bar (File > Close) to see the exact shortcut displayed next to the command.
How to Change or Customize the Shortcut
You can’t change the system-level Alt+F4 or Command+W shortcuts, but you can remap them using third-party tools like AutoHotkey (Windows) or Karabiner-Elements (Mac). For example, you could map Ctrl+Alt+W to send Alt+F4. However, remapping system shortcuts can cause conflicts, so it’s usually not worth it. Instead, many apps let you customize their own shortcuts in Settings > Keyboard Shortcuts.
Frequently Asked Questions
What is the shortcut to close a window in Windows 11?
Alt+F4 works exactly the same in Windows 11 as in Windows 10. The only difference is that if you press Alt+F4 on the desktop, you get the shutdown dialog, which now includes a “Sleep” option.
Does Ctrl+W close a window or a tab?
In browsers and most tabbed apps, Ctrl+W closes the current tab. If the window has only one tab, that tab closes and the window closes as well. In document-based apps like Word, Ctrl+W closes the document window, not the whole application.
How do I close a window with just the mouse?
Click the X button in the top-right corner (Windows) or the red button in the top-left (Mac). On Windows, you can also right-click the taskbar icon and choose “Close window”. On Mac, right-click the Dock icon and select “Quit” to close all windows of that app.
Why does Alt+F4 sometimes open the shutdown dialog?
If no window has focus (for example, you clicked on the desktop), Alt+F4 tells Windows to act on the desktop itself, which shows the shutdown options. Click on a window first, then press Alt+F4.
Is there a shortcut to close all windows of an app at once?
On Windows, press Alt+F4 repeatedly for each window, or right-click the taskbar icon and select “Close all windows” (available in some apps). On Mac, use Command+Option+W to close all windows of the current app, or Command+Q to quit the app entirely.
What’s the difference between closing a window and quitting an app?
Closing a window just hides that window, but the app may keep running in the background (especially on Mac). Quitting the app ends all processes and frees memory. On Windows, closing the last window usually quits the app, but some apps (like Slack) keep running in the system tray.
Related
- How to Update a Dictionary in Python
- Value Dollar Shop Jurong East: Location, Prices & What to Expect
- How to Select All on a Laptop: 5 Fast Ways
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Convert Text to Numbers in Excel: Methods That WorkTo convert text numbers in Excel, select the cells and choose the warning icon’s Convert to Number command…
- Java String Length: How the length() Method Really WorksIn Java, call length() on a String to get its length: for example, "Java".length() returns 4. The result…
- Excel Custom Number Format: Show Numbers in ThousandsTo show Excel values in thousands without changing the stored numbers, apply the custom format #,##0,. In Excel…
- Redo in Excel: Restore an Undone ActionTo redo an action in Excel for Microsoft 365 on Windows, press Ctrl+Y or click Redo on the…
- Embed Video in PowerPoint With HTML: Options That WorkPowerPoint does not turn pasted HTML into a video embedded on a slide. For a standard online video,…
- Excel Text to Columns Using Enter: Split Line BreaksTo split a cell at an embedded line break with Excel Text to Columns, choose Data > Text…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.