Sub topic 3
Keyboard shortcuts for tabs
This chapter assumes you can already open, switch, close, and reopen tabs with the mouse. It covers the same actions from the keyboard, the settings that change how some shortcuts behave, and how to add your own. Menu names can differ slightly between macOS versions. The menu bar always shows the shortcut currently assigned to a command.
Why learn tab shortcuts
Tab work is repetitive. You open a link, read it, close it, and go back. Each trip to the mouse costs a second or two, and those seconds add up over a day. The shortcuts below cover most of what you do with tabs, and a few of them recover from mistakes.
The shortcuts use these modifier keys:
| Symbol | Key |
|---|---|
| ⌘ | Command |
| ⌥ | Option |
| ⌃ | Control |
| ⇧ | Shift |
The core shortcuts
Learn the first four before any others.
| Action | Shortcut |
|---|---|
| New tab | ⌘T |
| Close the current tab | ⌘W |
| Reopen the last closed tab | ⇧⌘T |
| Select the Smart Search field | ⌘L |
| Next tab | ⌃Tab or ⇧⌘] |
| Previous tab | ⌃⇧Tab or ⇧⌘[ |
| Show or hide Tab Overview | ⇧⌘\ |
| Show or hide the sidebar | ⇧⌘L |
| New window | ⌘N |
| New Private Browsing window | ⇧⌘N |
Some details about these:
- ⌘T opens a tab and puts the cursor in the Smart Search field, so you can type immediately.
- ⌘W closes the current tab. If it is the only tab in the window, the window closes.
- ⇧⌘T reopens the most recently closed tab, and repeated presses reopen earlier ones. Use it when you close a tab by accident. It is the same command as History > Reopen Last Closed Tab.
- ⌘L selects the whole address, ready to be replaced. Pressing ⌘T and then typing does the same job for a new page.
- ⌃Tab and ⇧⌘] both move one tab to the right. You can use whichever is more comfortable. Most people prefer ⌃Tab because it matches other apps.
- ⇧⌘\\ shows every tab in the window as a thumbnail grid, and pressing it again returns you to the page. The next chapter covers Tab Overview and the sidebar in detail.
Jumping to a specific tab with ⌘1 through ⌘9
You can jump to a tab by its position with ⌘1, ⌘2, and so on. Safari has a setting that controls what these keys do.
- Choose Safari > Settings and click Tabs.
- Find the option labeled "Use ⌘-1 through ⌘-9 to switch tabs".
- Turn it on to make the number keys switch tabs. Turn it off, and the same keys open the items in your Favorites or bookmarks bar instead.
This is a common source of confusion. If ⌘1 loads a website when you expected it to select a tab, the setting is off. The shortcut is useful when you keep a stable set of tabs, such as email, calendar, and a task board, in the same order every day.
Opening links in new tabs
Clicking a link normally replaces the current page. Holding a key while you click changes that.
- ⌘-click opens the link in a new tab.
- ⇧⌘-click opens it in a new tab and does the opposite of the default for switching to it.
Which of these switches to the new tab depends on a setting in Safari > Settings > Tabs: "When a new tab or window opens, make it active". With that option off, ⌘-click opens the tab in the background and keeps you on your current page. That is good for opening several links from a search results page and reading them afterward. With the option on, ⌘-click takes you to the new tab and ⇧⌘-click opens it in the background.
If your shortcuts seem to do the reverse of what you expect, check this setting first.
Closing many tabs at once
Closing tabs one at a time is slow when you have dozens open.
- Option-click the close button (the ✕ on a tab) to close every other tab and keep the one you clicked.
- Right-click a tab (or Control-click it) and choose Close Other Tabs or Close Tabs to the Right.
Neither action needs a dedicated shortcut, but both are quick. If you close too many, ⇧⌘T brings them back one at a time, in reverse order.
A decision flow for everyday tab work
The diagram shows how the shortcuts fit together in a typical session.
Changing or adding shortcuts
macOS lets you assign your own shortcut to any menu command in any app. This is useful for commands that have no shortcut, such as Close Other Tabs.
- Open System Settings > Keyboard > Keyboard Shortcuts.
- Select App Shortcuts and click the + button.
- Set Application to Safari.
- In Menu Title, type the command's name exactly as it appears in the menu, including capitalization.
- Click the shortcut field and press the keys you want, then click Add.
Two points matter here. The menu title must match exactly, or the shortcut silently does nothing. Also, avoid combinations that Safari or macOS already uses, because the system shortcut may take priority. Menu titles change with the macOS version and your language, so a shortcut you add may stop working after an update. If it does, compare the title you typed with the current menu.
Triggering shortcuts from a script
You can also send the same keystrokes from a script. The next example uses AppleScript to bring Safari forward and press ⌘T:
tell application "Safari" to activate
tell application "System Events" to keystroke "t" using command downSending keystrokes requires permission. The first time, macOS may ask you to allow your script editor or Terminal to control the computer. You can grant this in System Settings > Privacy & Security > Accessibility. If nothing happens, a missing permission is the usual cause. A later chapter covers better ways to work with tabs from scripts, such as asking Safari for its tab names directly instead of simulating keys.
Common problems
- ⌘1 to ⌘9 open websites instead of switching tabs. The Tabs setting described above is off.
- ⌘-click opens a tab but you land on it. The "make it active" setting is on, so reverse the modifier or change the setting.
- ⌃Tab does nothing in a text field. A web page can capture some keys. Click outside the field, or use ⇧⌘] instead.
- ⇧⌘T reopens the wrong tab. It reopens the most recently closed one. Press it again to go further back.
- A custom shortcut does not work. Check the exact menu title and any conflict with an existing shortcut.
- A shortcut works in one window but not another. The window may be a Private Browsing window, which has fewer recovery options, or another app may have focus.
Exercise
You press ⌘1 and Safari loads a bookmark instead of selecting your first tab. What setting do you change, and where?
Show answer
Open Safari > Settings > Tabs and turn on "Use ⌘-1 through ⌘-9 to switch tabs". With it off, those keys open Favorites or bookmarks.
Exercise
You accidentally close a tab you were reading, then close a second one. What do you press to get both back, and in what order do they return?
Show answer
Press ⇧⌘T twice. The most recently closed tab returns first, then the one closed before it.
Exercise
You have 25 tabs open and want to keep only the current one. Name two ways to do it without closing each tab separately.
Show answer
Option-click the close button of the tab you want to keep, or right-click that tab and choose Close Other Tabs.