Keyboard Shortcut to Close Tab: All Browsers
The keyboard shortcut to close the current tab is Ctrl+W on Windows and Linux, and Command+W on macOS. In most browsers, Ctrl+F4 (or Cmd+F4 on Mac) also closes the active tab, and Ctrl+Shift+T (or Cmd+Shift+T) reopens the most recently closed tab if you close one by accident.
That single answer covers Chrome, Edge, Firefox, Safari, Opera, Brave, Vivaldi, and most other mainstream browsers. But the details matter: the shortcut behaves differently depending on how many tabs are open, whether the window is in full-screen mode, and which operating system and keyboard layout you use. The sections below explain how the shortcut works, when it does something unexpected, and how to recover from a mistaken close.
How the Close-Tab Shortcut Works Across Browsers
All major browsers follow the same convention because they inherit it from the operating system's window-management shortcuts. On Windows, Ctrl+W is a standard "close this document or window" command; on macOS, Command+W serves the same role. Browsers simply map that command to the active tab rather than the whole window.
The table below summarizes the most common variants. Note that the exact behavior can differ slightly by browser version, but the core shortcuts are stable.
- Windows / Linux: Ctrl+W closes the active tab. Ctrl+F4 also works in Chrome, Edge, and Firefox.
- macOS: Command+W closes the active tab. Command+F4 is not a standard Mac shortcut; use Command+W instead.
- Chrome OS: Ctrl+W closes the active tab, matching Linux behavior.
- Mobile browsers: There is no physical keyboard shortcut on phones and tablets; closing a tab requires tapping the tab switcher and then the close (X) icon.
One important nuance: in some browsers, Ctrl+W closes the entire window if only one tab is open. Chrome, Edge, and Firefox typically close the window when the last tab is closed, which also ends the browsing session. If you want to keep the window open with a blank tab, you can usually enable a setting or use an extension, but the default behavior is to close the window.
What Happens When You Close a Tab
Closing a tab does not immediately destroy the page. Most browsers keep a short-term "closed tab" history that lets you reopen recently closed tabs. In Chrome, Edge, and Firefox, the history holds the last 10 to 25 closed tabs, depending on the browser and version. Safari keeps a similar list under the History menu.
When you close a tab, the browser stops rendering the page and may discard its in-memory state, but it does not delete your browsing history, cookies, or saved form data unless you have configured it to clear those on exit. If you close a tab that contained an unfinished form, the browser may warn you before closing, depending on the site's implementation of the beforeunload event. Many sites do not use this warning, so unsaved work can be lost.
Reopening a closed tab restores the page from the browser's cache or reloads it from the server. If the page required a login session that has since expired, you may need to sign in again. The reopened tab usually appears at the end of the tab strip, not in its original position, though some browsers and extensions offer to restore the original order.
Recovering a Tab You Closed by Mistake
Accidental closes are common, especially when Ctrl+W is pressed instead of Ctrl+Q or when a keyboard shortcut conflicts with a website's own controls. The recovery shortcut is nearly universal:
- Press Ctrl+Shift+T (Windows/Linux) or Command+Shift+T (macOS) to reopen the most recently closed tab.
- Repeat the shortcut to reopen older closed tabs, one at a time, in reverse order of closing.
- If the shortcut does not work, open the browser menu (usually three dots or lines) and look for History > Recently closed or a similar entry.
- In Firefox, you can also right-click the tab strip and choose Undo Close Tab.
If you closed an entire window rather than a single tab, the same shortcut often reopens the whole window with all its tabs. Chrome and Edge restore the window and its tabs; Firefox restores the window as well. This works because the browser treats a closed window as a collection of closed tabs.
There is a limit to how far back the history goes. If you have closed many tabs since the one you want, the shortcut may no longer reach it. In that case, check the full history (Ctrl+H or Command+Y) and look for the page there. The history entry will still exist even if the tab is gone.
Common Problems and Conflicts
Sometimes Ctrl+W does not close the tab as expected. The most common reasons are:
- Keyboard layout differences: On some non-US layouts, the W key is in a different position, or Ctrl+W is reserved by the operating system. For example, on some Linux desktop environments, Ctrl+W may be captured by the window manager before the browser sees it.
- Browser extensions: Extensions that remap shortcuts or add their own keybindings can override Ctrl+W. Check the extension's settings or disable it temporarily to test.
- Website focus: If a web app (such as a text editor or a game) captures keyboard input, Ctrl+W may be intercepted by the page. In that case, click outside the app's canvas or use the browser's tab close button.
- Full-screen mode: In full-screen mode (F11 on Windows, Ctrl+Command+F on Mac), some browsers change shortcut behavior. Press Esc to exit full-screen and try again.
- Accessibility settings: Sticky Keys or Filter Keys on Windows can alter how modifier keys are registered, making Ctrl+W unreliable.
If Ctrl+W closes the entire window instead of a tab, it usually means only one tab was open. To avoid this, open a new tab before closing the last one, or use the browser's setting to "continue where you left off" so the window reopens with your tabs on next launch.
Alternatives to the Keyboard Shortcut
Not everyone wants to use a keyboard shortcut, and some situations call for a mouse or trackpad. Here are the main alternatives:
- Click the X on the tab: Every browser shows a small close icon on each tab, usually on the right side. Middle-clicking a tab also closes it in most browsers.
- Right-click the tab: The context menu includes Close tab, Close other tabs, and Close tabs to the right.
- Browser menu: The main menu (three dots or lines) has a Close tab option in some browsers, though it is often buried.
- Trackpad gestures: On macOS, a three-finger swipe up can open Mission Control, where you can close windows; some third-party tools add tab-closing gestures.
Middle-clicking is a fast mouse-only method that many users overlook. It works in Chrome, Edge, Firefox, and Safari, and it closes the tab under the pointer without switching to it first.
Safety and Privacy Considerations
Closing a tab does not log you out of a website. If you close a tab on a shared computer, the next person who opens the browser may still be able to access the site if the session cookie remains active. To end a session, use the site's logout button before closing the tab.
Similarly, closing a tab does not clear your browsing history. If you need to remove a page from history, use the browser's history manager (Ctrl+H or Command+Y) and delete the entry. Private or incognito windows discard history and cookies when the last private tab is closed, but regular tabs do not.
Be cautious with the Ctrl+Shift+W shortcut, which closes the entire window in some browsers. It is easy to press by accident when aiming for Ctrl+Shift+T. If you close a window this way, the same reopen shortcut (Ctrl+Shift+T) usually restores it.
Frequently Asked Questions
What is the shortcut to close a tab in Chrome?
Ctrl+W on Windows and Linux, Command+W on macOS. Ctrl+F4 also works on Windows. To reopen the tab, press Ctrl+Shift+T or Command+Shift+T.
How do I close a tab without a keyboard?
Click the X icon on the tab, middle-click the tab, or right-click the tab and choose Close. On mobile, tap the tab switcher and then the X on the tab you want to close.
Why does Ctrl+W close my whole browser window?
It closes the window when only one tab is open, because the browser treats the last tab as the window itself. Open a new tab first if you want to keep the window open.
Can I change the close-tab shortcut?
Most browsers do not offer a built-in way to remap Ctrl+W. Some extensions and operating-system-level tools can reassign it, but results vary by browser and platform.
Does closing a tab stop a download?
Usually not. Downloads continue in the background even if you close the tab that started them, as long as the browser remains open. Closing the entire browser may pause or cancel the download, depending on the browser's settings.
What is the shortcut to close all tabs at once?
There is no universal shortcut for closing all tabs. Ctrl+Shift+W closes the window (and all its tabs) in some browsers. Otherwise, right-click a tab and choose Close other tabs, or close the window entirely.