How to Close a Window With Your Keyboard: Shortcuts for Every OS
Reaching for the mouse every time you want to close a window is one of those small friction points that adds up fast. Whether you're editing documents, switching between apps, or just trying to keep your desktop organized, keyboard shortcuts for closing windows are some of the most practical you can learn — and they vary more than most people expect.
The Core Distinction: Closing a Window vs. Quitting an App
Before diving into shortcuts, it's worth understanding a distinction that trips people up constantly.
Closing a window and quitting an application are not always the same thing.
- On Windows, closing the last window of an app usually quits the app entirely.
- On macOS, closing a window often leaves the app running in the background — the app remains open even though nothing is visible on screen.
This matters because the "right" shortcut depends on what you actually want to accomplish.
Windows Keyboard Shortcuts for Closing Windows 🪟
On a Windows PC, you have several options depending on the situation:
| Shortcut | What It Does |
|---|---|
Alt + F4 | Closes the active window or app |
Ctrl + W | Closes the current tab or document (in supported apps) |
Ctrl + F4 | Closes the active document in multi-document apps |
Win + W | Opens Widgets (Windows 11) — not a close shortcut |
Alt + F4 is the most universal. It works across nearly every app and window in Windows, including File Explorer, browsers, and desktop programs. If you press it on the desktop itself (with no window focused), it brings up the Shut Down dialog — a detail worth knowing before you accidentally trigger it.
Ctrl + W is more context-specific. In browsers like Chrome, Edge, or Firefox, it closes the active tab without closing the entire browser window. In Microsoft Office apps, it closes the current document. It won't work in every application — some ignore it entirely.
Closing Apps in the Taskbar
If a window is minimized or you want to close something without bringing it into focus, you can:
- Right-click the app on the taskbar
- Select Close window
There's no direct keyboard-only method to close taskbar items without a mouse unless you use Alt + Tab to bring the window into focus first.
macOS Keyboard Shortcuts for Closing Windows 🍎
macOS has its own set of shortcuts, and the window/app distinction is especially relevant here:
| Shortcut | What It Does |
|---|---|
Cmd + W | Closes the active window |
Cmd + Q | Quits the application entirely |
Cmd + Option + W | Closes all windows of the current app |
Ctrl + W | Not standard in macOS |
Cmd + W is the go-to for closing a window on Mac. In Safari or Chrome, it closes the current tab. In Finder, it closes the active Finder window. But the app keeps running — you'll see the dot below its icon in the Dock.
Cmd + Q is what you need when you want to fully exit an app, not just hide its window. New Mac users often miss this entirely, leaving dozens of apps running invisibly in the background.
Cmd + Option + W is a less-known shortcut that becomes genuinely useful when you've accumulated ten Finder windows or multiple browser windows and want to sweep them all away at once.
Linux: It Depends on Your Desktop Environment
Linux doesn't have a single universal shortcut because it runs on multiple desktop environments, each with its own defaults.
| Desktop Environment | Default Close Shortcut |
|---|---|
| GNOME | Alt + F4 |
| KDE Plasma | Alt + F4 |
| XFCE | Alt + F4 |
| MATE | Alt + F4 |
Most Linux desktop environments follow the same Alt + F4 convention as Windows, making it one of the more consistent behaviors across platforms. That said, shortcuts in Linux are almost always customizable through system settings or configuration files, so power users often remap them to whatever feels natural.
Browser-Specific Shortcuts Worth Knowing
Since so much computing happens inside browsers now, tab and window management shortcuts deserve their own mention:
| Action | Windows/Linux | macOS |
|---|---|---|
| Close current tab | Ctrl + W | Cmd + W |
| Close current window | Alt + F4 | Cmd + W (window-level) |
| Reopen closed tab | Ctrl + Shift + T | Cmd + Shift + T |
The reopen closed tab shortcut is one many people discover too late — it works in Chrome, Firefox, Edge, and Safari, and it can be a lifesaver after an accidental Ctrl + W.
What Affects Which Shortcut You Should Use
The "best" keyboard shortcut for closing a window isn't one-size-fits-all. Several variables shape which approach works for a given person:
- Operating system — Windows, macOS, and Linux each have different conventions
- App type — A browser behaves differently than a text editor or a system window
- Whether you want to quit or just close — Especially relevant on macOS
- Keyboard layout — Some compact or international keyboards remap modifier keys, which can change shortcut behavior
- Customization — Power users on any platform may have remapped defaults entirely
- Accessibility settings — Some OS-level accessibility configurations alter how shortcuts function
A shortcut that's second nature to a longtime Windows user may feel counterintuitive on macOS, and vice versa. Even within the same OS, someone who works primarily in a browser all day has different muscle memory needs than someone managing dozens of desktop app windows.
The gap between knowing the shortcuts and knowing which shortcut fits your actual workflow is the part only you can fill — because it depends entirely on what you're running, how you've configured it, and what closing a window actually means in your day-to-day use.