You always have the option to hide the active program. When the application in question is active (in front of all others) there are 2 options:

  1. option +click on the Desktop
  2. command +h

The first option always works or at least I can't think of any exceptions this minute. The second is supported by most applications.

In either case:

  1. Your session will be preserved.
  2. Neither will cause these windows to be displayed in the Dock where the minimized programs are located.
  3. You'll need both hands.

So, if you're scanning eBay at work, you'll likely only look suspicious. But, if you lean into it and use + (command+tab) PLUS +h in succession, you might actually look like you're doing work.

But, in the event you're asked to bring your browser back to the forefront you'll be busted. It will display exactly what you were looking at when you hid it.

You can imagine how I know this :-)

Answer from todd_dsm on Stack Exchange
🌐
Reddit
reddit.com › r/macos › close app window with keyboard shortcut
r/MacOS on Reddit: Close app window with keyboard shortcut
November 17, 2024 -

Is there any keyboard shortcut or any app that ALWAYS closes the focused window? I would love to use cmd+w but some apps overtake the behavior and just close a tab instead. I don't like this inconsistency. The only thing that is consistent is the red window button. However it takes time to always move the cursor to the red button.

Anyone knows a way to bind a keyboard shortcut to clicking the red dot? BetterTouchTool has a "click red window button", but in some apps it doesn't work.

Same for CMD+H, some apps don't react to it (PDFSearch e.g.), but they react to the red window button click.

Thank you!

Top answer
1 of 7
9

You always have the option to hide the active program. When the application in question is active (in front of all others) there are 2 options:

  1. option +click on the Desktop
  2. command +h

The first option always works or at least I can't think of any exceptions this minute. The second is supported by most applications.

In either case:

  1. Your session will be preserved.
  2. Neither will cause these windows to be displayed in the Dock where the minimized programs are located.
  3. You'll need both hands.

So, if you're scanning eBay at work, you'll likely only look suspicious. But, if you lean into it and use + (command+tab) PLUS +h in succession, you might actually look like you're doing work.

But, in the event you're asked to bring your browser back to the forefront you'll be busted. It will display exactly what you were looking at when you hid it.

You can imagine how I know this :-)

2 of 7
22

Typically, an application will offer a way to both close the UI and quit the application. These are usually standardized to command ⌘+W to close the UI/window and command ⌘+Q to quit the application.

Some applications will still quit entirely when you use command ⌘+W, such as Preview. You can usually rely on this shortcut to close the window without quitting, however.

I should also point out that the red button in the top left does not "quit" the application as you mentioned in the question body. It will close the window (just like command ⌘+W).

Edit: In recent versions of macOS, with the advent of tabs, the behavior is slightly different:

Keyboard Effect
command ⌘+W Closes the Tab
command ⌘+shift+W Closes the Window
Discussions

keyboard - On a mac, how can I force-close a window of an app (NOT the app itself)? - Ask Different
I'm looking for a keyboard shortcut to close a window of an app, skipping the "Would you like to save" pester dialog, while leaving the app, itself, and other windows, still open. If there's no way to do that, is there a keyboard shortcut for hitting a certain button in a window/dialog? In Windows, this would typically be ALT+[first letter of the button text]. ... I don't know about force-closing a window, but on Mac ... More on apple.stackexchange.com
🌐 apple.stackexchange.com
Keyboard shortcut to close dialog windows - Apple Community
They won't close until you mouse over and click on the little red button. That's what I'd like a keyboard shortcut for. ... baltwo wrote: Do note that CMD+period will execute the CANCEL button in any window or dialog box that has a CANCEL button. In a lot of apps you can shortcut the buttons with ... More on discussions.apple.com
🌐 discussions.apple.com
December 31, 2008
Just wanna be sure: Is there a way to close a window and the programm itself simultaneously on MacOS?
CMD + Q closes the application i.e. all windows of it. CMD + W closes the active window only. More on reddit.com
🌐 r/MacOS
11
2
November 7, 2021
Is there a fast way to close all open windows of an app on Mac?
Cmd-Option-W More on reddit.com
🌐 r/MacOS
36
30
May 12, 2022
🌐
Apple Support
support.apple.com › en-us › 102650
Mac keyboard shortcuts - Apple Support
1 week ago - To close all windows of the app, press Option-Command-W. Option-Command-Esc: Force quit an app. Command–Space bar: Show or hide the Spotlight search field. To perform a Spotlight search from a Finder window, press Option–Command–Space bar.
🌐
MacSales.com
eshop.macsales.com › home › mac 101: window management keyboard shortcuts
Mac 101: Window Management Keyboard Shortcuts
November 13, 2019 - 1) Close the current window (Command + W) This keyboard shortcut has been around since the first Macs rolled out of the factories back in 1984. It’s a very common keyboard shortcut to use, and it can save a lot of time and poking around with ...
🌐
YouTube
youtube.com › watch
How to close Windows or Tabs in the Mac Keyboard shortcut for ALT + F4 - YouTube
How to close a tab or window in Mac OSWhat is the shortcut to close the Mac tab or Window or an ApplicationALT + F4 in MacALT + F4 equivalent in MacSubscri...
Published   June 13, 2024
Top answer
1 of 1
4

To press a button in a dialog using a keyboard shortcut, press Command, followed by the first letter of the action you wish to trigger. The exception to this rule is if the action you wish to activate will delete a file or changes thereto, in which case the shortcut is Command-delete.

To force-close a window, you'd need to automate the correct series of key presses using AppleScript or something similar. The first key combination would likely be Command-W (though not even this is entirely universal). However, the dialog shortcuts vary by application—older versions of Microsoft Word don't comply with the Command-delete behavior (they use Command-D), while Automator's save sheets can often only be closed through mouse input. You would have to tailor this behavior to the specific applications in which you're interested. Such an AppleScript might look something like this (though be warned, triggering Command-delete without knowing the context is an easy way to accidentally delete files and large swathes of text):

tell application "System Events"
    keystroke "w" using {command down} -- Command-W
    delay 0.5 -- Wait for the dialog to appear
    key code 51 using {command down} -- Command-delete
end tell

To tie an AppleScript to a keyboard shortcut:

  • Open Automator (Applications > Utilities > Automator) and create a new Service (optionally, configure it just to run in the applications you want).
  • Add a "Run AppleScript" block in which you write your AppleScript.
  • Open System Preferences > Keyboard > Shortcuts.
  • Create a new shortcut, where the "Menu Title" is the title you gave your Service (again, you can tie this shortcut just to the applications to which your Service applies). The keyboard shortcut you enter here is the one you can use to trigger your "force close" behavior.

You could create multiple services, each one with the same keyboard shortcut but in different applications, corresponding to the unique behavior of each.

Find elsewhere
🌐
Chron.com
smallbusiness.chron.com › close-windows-mac-using-keyboard-67823.html
How to Close Windows on a Mac Using the Keyboard
November 22, 2017 - Press and hold "Command-W" to close the window that is active on your Mac's screen. The Command key is also known as the Apple key on some keyboards.
🌐
DeviceMAG
devicemag.com › gadgets › computers & laptops › how to quickly close windows on your macbook?
How to Quickly Close Windows on Your Macbook? - DeviceMAG
October 14, 2025 - To close the front window, press Command-W. To close all windows of an app, press Option-Command-W. If you need to force quit an app, press Option-Command-Esc or choose Force Quit from the Apple menu in the corner of your screen.
🌐
Apple Community
discussions.apple.com › thread › 1846311
Keyboard shortcut to close dialog windows - Apple Community
December 31, 2008 - Do note that CMD+period will execute the CANCEL button in any window or dialog box that has a CANCEL button. ... Dialog boxes have no red close button; they have a Cancel or Okay (or Done) button, one of which is blue and that is the active button. So if you click on the blue button or press Enter or Return, that is the action that is chosen. Thus, there is no keyboard shortcut for them, nor can there be.
🌐
Wikihow
wikihow.com › computers and electronics › basic computer skills › how to close windows on pc, mac, android, and iphone
How to Close Windows on PC, Mac, Android, and iPhone
August 22, 2025 - Press ⌘ Cmd+W to close the active window. This keyboard shortcut works in the same way as clicking the red circle at the top-left corner.[3] X Research source · If you're using an app with tabs, such as a web browser, this shortcut will close ...
🌐
Business Insider
businessinsider.com › business insider › how to close all the windows on a mac computer using safari, in 2 different ways
How to close all the windows on a Mac computer using Safari, in 2 different ways
August 23, 2022 - To close all Mac browser windows with a keyboard shortcut, hold down the option and command keys (the latter is known to some as the Apple key) and then press W.
🌐
Reddit
reddit.com › r/macos › just wanna be sure: is there a way to close a window and the programm itself simultaneously on macos?
r/MacOS on Reddit: Just wanna be sure: Is there a way to close a window and the programm itself simultaneously on MacOS?
November 7, 2021 - CMD + Q closes the application i.e. all windows of it. CMD + W closes the active window only. ... Keep in mind sometimes closing the window quits the app. Usually, the logic is if nothing useful can be done without an active window, the app quits.
🌐
Macinstruct
macinstruct.com › tutorials › how-to-close-all-windows-in-a-mac-application
How to Close All Windows in a Mac Application | Macinstruct
Here’s how to close all windows in a Mac application using a menu item: Hold down the Option key on your keyboard.
🌐
Oreate AI
oreateai.com › blog › mastering-your-mac-the-simple-shortcut-to-closing-windows › 50bf946ff4993905d4fea712bdc61b0b
Mastering Your Mac: The Simple Shortcut to Closing Windows - Oreate AI Blog
2 weeks ago - So, if you want to close just one window and keep the app running in the background, Command-W is your go-to. If you want to shut down the application completely, then Command-Q is what you'll need. This little shortcut is incredibly handy for streamlining your workflow. It helps you declutter your screen quickly, allowing you to focus on what's most important. I remember when I first started using Macs, I'd often find myself clicking the little red 'x' button in the corner of each window.
🌐
O'Reilly
oreilly.com › library › view › robin-williams-mac › 0321169662 › 0321169662_ch06lev1sec16.html
Close or minimize all of the Windows - Robin Williams Mac OS X Book, Jaguar Edition, The [Book]
December 26, 2002 - The keyboard shortcut to close a window is Command W. To close all the windows at once, press Command Option W. To minimize all the windows at once, hold down the Option key and click the Minimize button (the yellow one) in the upper-left corner ...
Author   Robin Williams
Published   2002
Pages   808
🌐
Reddit
reddit.com › r/macos › is there a fast way to close all open windows of an app on mac?
Is there a fast way to close all open windows of an app on Mac? : r/MacOS
May 12, 2022 - Or you can hold down the option key and click the red button in the top left of one of the windows. They’ll all close. ... Holy shit. I’ve been using Macs since they were Macintoshes and never knew this*!*
🌐
Quora
quora.com › How-can-one-close-all-the-apps-in-a-Mac-OS-X-computer-at-once
How can one close all the apps in a Mac OS X computer at once? - Quora
Answer: On your Mac, do any of the following: * Close a single window: In a window, click the red Close button in the window's top-left corner, or press Command-W. * Close all open windows for an app: Press Option-Command-W. Closing one or all ...
🌐
SweetCare
sweetwater.com › home › articles › what is the keyboard shortcut to close a window in mac os x?
What is the keyboard shortcut to close a window in Mac OS X? | Sweetwater
November 11, 2022 - Check out the What is the keyboard shortcut to close a window in Mac OS X? page at Sweetwater — the world's leading music technology and instrument retailer!