Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Keyboard Shortcut to Close: Windows, Mac & Browser

· 6 min read · Home Automation

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To close the active window or tab, press Alt + F4 on Windows or Command (⌘) + W on a Mac. Those two shortcuts cover most situations, but the exact key depends on what you are closing: a browser tab, a full application window, a dialog box, or a document inside an app. The steps below walk through each case, plus the mistakes that make the shortcut seem broken and the fixes when it does not respond.

What You'll Need

  • A keyboard with a working Alt, Ctrl, Command (⌘), or Option (⌥) key, depending on your system.
  • Windows, macOS, ChromeOS, or a Linux desktop. Mobile phones and tablets do not have a physical close shortcut, so this guide covers computers only.
  • No extra software. Every shortcut here is built into the operating system or the app itself.

Step-by-Step

  1. Decide what you are closing. A browser tab is not the same as a whole browser window, and a dialog box is not the same as an app. The shortcut changes with the target.
  2. To close the current tab in a browser (Chrome, Edge, Firefox, Safari), press Ctrl + W on Windows or Linux, or Command (⌘) + W on a Mac. This closes only the tab in focus, not the whole browser.
  3. To close the whole browser window including all its tabs, press Ctrl + Shift + W (Windows/Linux) or Command (⌘) + Shift + W (Mac). Some browsers also accept Alt + F4 on Windows, which closes the entire window.
  4. To close any active application window on Windows, press Alt + F4. If the app has unsaved work, it will prompt you to save first. On a Mac, press Command (⌘) + W to close the front window, or Command (⌘) + Q to quit the app entirely.
  5. To close a dialog box or pop-up inside an app, press Esc first. If that does nothing, try Alt + F4 on Windows or Command (⌘) + W on a Mac. Many dialogs also accept Enter if the default button is Cancel or Close.
  6. To close a document inside an app (for example, a Word file or a PDF), use Ctrl + W on Windows or Command (⌘) + W on a Mac. This closes the document but leaves the application running, so you can open another file.
  7. To close a window on ChromeOS, press Ctrl + W for a tab or Shift + Ctrl + W for the whole window. On most Chromebooks, Alt + F4 is not the default close shortcut, so stick with the Ctrl combinations.
  8. Confirm the result. The tab or window should disappear immediately. If a save prompt appears, choose Save or Don't Save as appropriate. If nothing happens, move on to the troubleshooting section below.

Menu labels and shortcut assignments can differ slightly by app version, operating system version, and region, so if a key combination does not match what you see in the app's menus, check the app's own keyboard shortcut list.

Common Mistakes

  • Using Alt + F4 on a Mac. That combination is a Windows convention. On macOS, use Command (⌘) + W or Command (⌘) + Q.
  • Pressing Ctrl + W when you meant to close the whole window. Ctrl + W closes only the current tab or document. The app stays open, which can look like the shortcut failed.
  • Forgetting that some apps intercept the shortcut. Games, remote desktop clients, and full-screen video players often capture Alt + F4 or Ctrl + W for their own use. Try Esc first, then the app's own close button.
  • Assuming Esc closes everything. Esc cancels a dialog or exits full-screen mode, but it does not close a normal window or tab.
  • Pressing the keys one at a time. Modifier keys (Ctrl, Alt, Shift, Command) must be held down while you press the final key. Releasing Ctrl before pressing W will not trigger the shortcut.

Tips

  • Reopen a tab you closed by accident. In most browsers, press Ctrl + Shift + T (Windows/Linux) or Command (⌘) + Shift + T (Mac) to restore the most recently closed tab. Repeat to reopen earlier ones.
  • Close all tabs except the current one. Right-click the tab and choose the close-other-tabs option from the context menu; the exact wording varies by browser.
  • Use the app's own shortcut list. Most desktop apps show their shortcuts in the menu next to each command, so you can confirm the correct combination without guessing.
  • Check the Fn key on laptops. Some compact laptops map the top row to media keys by default. If Alt + F4 does nothing, try Alt + Fn + F4.
  • Save before you close. Alt + F4 and Command + Q will prompt you to save in most apps, but not all. Get in the habit of pressing Ctrl + S or Command + S first.

Troubleshooting

If the shortcut does nothing, work through these checks in order. They go from simplest to most disruptive, so stop as soon as the shortcut works again.

  1. Click the window first. Keyboard shortcuts apply to the window that has focus. If you clicked another window or the desktop, the keys go there instead.
  2. Check for a stuck modifier key. Press each of Ctrl, Alt, Shift, and the Windows key once to release any that are physically stuck, then try again.
  3. Try the menu equivalent. Open the app's File menu and look for Close or Exit. If the menu command works but the shortcut does not, the app may have reassigned the shortcut.
  4. Restart the app. Close it from the menu or the taskbar, reopen it, and test the shortcut again.
  5. Restart the computer. This clears temporary keyboard and input issues that survive an app restart.
  6. Test the keys in another app. Open a new browser tab and press Ctrl + W or Command + W. If it closes there, the problem is with the original app, not the keyboard.
  7. Check keyboard layout and language settings. A non-standard layout can remap modifier keys. Switch to your usual layout in the system settings and test again.
  8. Update the app and the operating system. Shortcut bugs are sometimes fixed in updates. Install the latest official version from the developer or the system's update tool.
  9. Reinstall the app as a last resort. Uninstalling and reinstalling can restore default shortcuts, but it may also remove saved settings. Back up your data first, and only use official installers.

Frequently Asked Questions

What is the keyboard shortcut to close a window?

On Windows, Alt + F4 closes the active window. On macOS, Command (⌘) + W closes the front window, and Command (⌘) + Q quits the app.

How do I close a tab without closing the browser?

Press Ctrl + W on Windows or Linux, or Command (⌘) + W on a Mac. That closes only the current tab and leaves the browser running.

Why does Alt + F4 not work on my Mac?

Alt + F4 is a Windows shortcut. macOS uses Command (⌘) + W to close a window and Command (⌘) + Q to quit an app.

Can I close a frozen app with a keyboard shortcut?

Alt + F4 may not respond if the app is frozen. On Windows, press Ctrl + Shift + Esc to open Task Manager, select the app, and end the task. On a Mac, press Option + Command + Esc to open the Force Quit dialog. Ending a task or force-quitting can lose unsaved work, so use it only when the app will not close normally.

Is there a shortcut to close all tabs at once?

There is no universal shortcut for closing every tab in every browser. Some browsers accept Ctrl + Shift + W or Command (⌘) + Shift + W to close the whole window, which closes all its tabs. Otherwise, right-click a tab and use the close-other-tabs option.

Does Esc close a window?

No. Esc closes or cancels a dialog box and exits full-screen mode, but it does not close a normal application window or browser tab.