How to Close a Tab on Keyboard: Shortcuts for Every Browser and OS

Closing browser tabs with a mouse works fine — until you're deep in a workflow and switching between dozens of open pages. Keyboard shortcuts make tab management faster, more precise, and less disruptive to your rhythm. The right shortcut depends on your operating system, browser, and what exactly you're trying to close.

The Universal Tab-Closing Shortcut

On Windows and Linux, the standard keyboard shortcut to close the active browser tab is:

Ctrl + W

On macOS, the equivalent is:

Cmd + W

These shortcuts work across virtually every major browser — Chrome, Firefox, Edge, Safari, Opera, and Brave — and have been consistent for years. If you only learn one tab shortcut, this is it.

It's worth noting that Ctrl + W (or Cmd + W) closes the currently active tab, not the entire browser window. If you have only one tab open and press this shortcut, most browsers will close the window entirely instead.

Closing the Entire Browser Window with a Shortcut

There's an important distinction between closing a tab and closing a window:

ActionWindows/LinuxmacOS
Close current tabCtrl + WCmd + W
Close entire windowCtrl + Shift + WCmd + Shift + W
Quit browser entirelyAlt + F4Cmd + Q

Ctrl + Shift + W (or Cmd + Shift + W) closes all tabs in the current window simultaneously. Use this carefully — it's easy to accidentally wipe out a full session.

How to Reopen a Tab You Just Closed 🔄

Accidentally closing a tab with a keyboard shortcut is common. Every major browser includes a recovery shortcut:

Ctrl + Shift + T (Windows/Linux) Cmd + Shift + T (macOS)

This reopens the most recently closed tab and restores it to its previous position. Pressing it repeatedly cycles through your recent tab history. This shortcut works in Chrome, Firefox, Edge, Opera, and most Chromium-based browsers.

Safari on macOS handles this differently — you can reopen closed tabs through History > Recently Closed, or by using Cmd + Z immediately after closing, though behavior may vary by Safari version.

Closing Tabs You're Not Currently On

The shortcuts above only close the active tab. If you want to close a different tab without clicking on it first, your options depend on the browser.

In most browsers, you can:

  1. Use Ctrl + Tab (or Ctrl + Shift + Tab) to cycle to the tab you want to close
  2. Then press Ctrl + W to close it

Some browsers and extensions also support closing tabs by tab number. For example, Ctrl + 1 through Ctrl + 8 jumps to a specific tab position, and Ctrl + 9 jumps to the last tab — useful for navigating before closing.

There's no universal keyboard shortcut for closing a tab without first making it active. Doing so typically requires a mouse click or a browser extension that adds custom shortcut behavior.

Browser-Specific Behavior Worth Knowing

Chrome and Edge share the same shortcut set (both are Chromium-based). Tab behavior, including the close shortcut, is nearly identical between them.

Firefox supports the same shortcuts but also allows custom keyboard shortcut mapping through extensions. If you're a heavy keyboard user, Firefox's add-on ecosystem gives you more granular control.

Safari on macOS follows the Cmd + W convention but diverges slightly on session restoration and tab history management. Power users on macOS sometimes find Safari's tab keyboard controls less flexible than Chrome or Firefox.

Mobile browsers — on iOS or Android — generally don't support hardware keyboard tab shortcuts unless you're using an external keyboard. Even then, support varies by app and OS version.

Keyboard Shortcuts in Non-Browser Contexts 🖥️

The tab-closing concept extends beyond browsers:

  • In terminal emulators (like Windows Terminal or iTerm2 on macOS), Ctrl + W or Ctrl + Shift + W often closes the active tab, depending on configuration
  • In code editors like VS Code, Ctrl + W closes the current editor tab, and Ctrl + K W closes all open tabs
  • In file explorers on Windows 11 (which now supports tabs), Ctrl + W closes the active tab as well

The muscle memory for Ctrl + W tends to transfer across applications that use tab-based interfaces — though not universally. Always verify behavior in an unfamiliar app before assuming it matches browser conventions.

Variables That Affect Which Shortcut Works for You

Not every shortcut behaves identically across all setups. A few factors that can change the experience:

  • Operating system: macOS uses the Cmd key where Windows uses Ctrl — a small but constant difference
  • Browser version: Older browser versions may not support all shortcut behaviors, particularly around session restoration
  • Custom keyboard remapping: Tools like AutoHotkey (Windows) or Karabiner-Elements (macOS) can reassign keys entirely, which may interfere with or override default shortcuts
  • Keyboard layout: Non-US keyboard layouts occasionally place modifier keys differently, which affects shortcut ergonomics
  • Accessibility settings: Some OS-level accessibility features intercept certain key combinations before the browser receives them
  • Browser extensions: Extensions can intercept or override shortcuts, particularly those designed for tab management

Whether the standard shortcuts work cleanly — or require adjustment — depends on how your specific system and browser are configured.