The fastest way to close a page
Press Alt + F4 on Windows or Command + W on Mac. This closes the current window or tab instantly, no mouse required. On Windows, Alt + F4 closes the entire application if you have only one window open; if you have multiple windows, it closes just the active one. On Mac, Command + W closes the current tab or window, and the application stays open.
If you want to close the entire browser instead of just one tab, use Alt + F4 on Windows (which closes the whole application) or Command + Q on Mac (which quits the browser entirely). These are the standard shortcuts across nearly all applications on both operating systems, not just web browsers.
Key Takeaways
- Alt + F4 on Windows closes the current window; Command + W on Mac closes the current tab.
- Command + Q on Mac quits the entire browser application, while Alt + F4 on Windows does the same if only one window is open.
- Ctrl + W works as an alternative to Command + W on Mac and closes the current tab in most browsers on Windows as well.
- These keyboard shortcuts work in nearly every application on your computer, not just web browsers.
Browser-specific shortcuts for closing tabs
Most web browsers — Chrome, Firefox, Safari, Edge — respond to Ctrl + W on Windows to close the current tab while keeping the browser open. On Mac, Command + W does the same thing. This is useful when you have multiple tabs open and want to close only the one you are viewing.
If you have accidentally closed a tab and want to reopen it, press Ctrl + Shift + T on Windows or Command + Shift + T on Mac. This restores the most recently closed tab. You can press it multiple times to reopen tabs in reverse order of when you closed them.
Closing multiple tabs at once
To close all tabs except the one you are currently viewing, most browsers do not have a single keyboard shortcut. Instead, you can close tabs one at a time using Ctrl + W or Command + W, or you can close the entire browser window and reopen it fresh.
If you want to close the browser completely and start over, use Alt + F4 on Windows or Command + Q on Mac. When you reopen the browser, it will either show your home page or restore your previous session, depending on your browser settings. You can change this behavior in your browser's preferences under "On startup" or "When you open Chrome/Firefox/Safari".
Why keyboard shortcuts are faster than the mouse
Reaching for the mouse takes longer than pressing two keys. Your hands are already on the keyboard when you are typing or reading, so using Alt + F4 or Command + W means you never break your workflow. Studies on input device efficiency show that keyboard shortcuts are consistently faster for frequent actions, especially when your hands are already positioned for typing.
This matters most when you are closing many pages in succession — switching between keyboard and mouse for each one adds up quickly. Once you memorize one or two shortcuts, they become automatic, and you will find yourself using them without thinking.
What happens when you close a page with unsaved work
If you close a page that contains a form you have been filling out, most browsers will warn you before closing. You will see a dialog box asking "Are you sure you want to leave this page?" or "Changes you made may not be saved." This gives you a chance to cancel the close action and save your work first.
Some websites, like Google Docs or Gmail, automatically save your work as you type, so closing the page will not lose anything. Other sites, like comment forms or shopping carts, do not save automatically. If you see a warning dialog, click "Stay on page" or "Cancel" to go back, then save or submit your work before closing.
Closing pages in different browsers
The shortcuts listed here work in Chrome, Firefox, Safari, and Edge. However, some older browsers or specialized applications may use different shortcuts. If Alt + F4 or Command + W does not work in a particular program, check the application's menu under "File" or "Edit" — the keyboard shortcut will be listed next to the "Close" or "Exit" option.
Some browsers also allow you to customize keyboard shortcuts through extensions or settings. In Chrome, you can view all shortcuts by pressing Ctrl + ? (or Command + ? on Mac). Firefox has a similar shortcut list accessible through the Help menu. Knowing the standard shortcuts first makes it easier to spot any custom ones your browser uses.
Frequently Asked Questions
What is the difference between closing a tab and closing a window?
Closing a tab (Ctrl + W or Command + W) closes only that one page while the browser stays open with your other tabs. Closing a window (Alt + F4 on Windows or Command + W on Mac when it is the last tab) closes the entire browser window. If you have multiple browser windows open, closing one does not affect the others.
Will closing a page with Alt + F4 delete my browsing history?
No. Closing a page or window does not delete your browsing history, cookies, or saved passwords. Your history remains in the browser until you manually clear it through the browser's settings. If you want to delete your history when you close the browser, you can enable that option in your browser's privacy settings.
Can I close a page if a website is preventing me from leaving?
Yes. Some websites try to show a dialog box when you attempt to close them, but pressing Alt + F4 or Command + W will close the page regardless. The keyboard shortcut bypasses any dialog the website displays. If the shortcut does not work, your browser may have frozen, and you may need to force-quit the application through your operating system.
What if my keyboard does not have an Alt key or Command key?
Most keyboards have these keys, but if yours does not, you can close pages using your browser's menu. Click the three-line menu icon (usually in the top right corner), then select "Close tab" or "Close window". You can also right-click on a tab and select "Close tab" from the menu that appears.