How to Keep Safari Open Even After Closing the Last Tab

Akshata Shanbhag 08-03-2016

When you’re down to the last tab on Safari and you hit Command+W to close that tab, Safari closes the window itself. This is one of Safari’s most annoying quirks. Thankfully, it does have a workaround that involves creating a simple keyboard shortcut How To Create A Keyboard Shortcut For Any Mac Menu Item Is there no keyboard shortcut for something you do regularly? That’s annoying, but here’s the good news: on your Mac you can add one easily, without the need for extra software. Read More .


When you have multiple tabs open in Safari, if you go to the File menu, you’ll see that the Command+W shortcut is assigned to the Close Tab function. So far so good.

Now close all unpinned tabs except one and visit the File menu again. What do you see? The Command+W shortcut appears assigned to the Close Window function. No wonder Safari closes the window when you use that shortcut.


To fix this behavior, first go to System Preferences > Keyboard > Shortcuts > App Shortcuts. Click on the + icon below the section on the right to create a new Safari shortcut.

In the dialog that pops up, choose Safari from the Application: dropdown, type Close Tab in the Menu Title: field, and hit Command+W when the cursor is in the Keyboard Shortcut: field. Save the shortcut by clicking on the Add button.


This tweak forces Command+W to trigger the Close Tab function every time you use it. The drawback here is that if you do want to close the last tab, you’ll have to close the window, either by clicking on the window’s Close button or by hitting Command+Shift+W.

You might also want to try the AppleScript shared in this Reddit thread to make Safari open a blank new tab when you close the last tab in that window. It did not work for me though.

If there’s a different fix that worked for you, tell us about it!

Image Credit: Vintage typewriter by MyImages – Micha via Shutterstock

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Alex
    January 19, 2019 at 3:18 pm

    Akshata, that's a GREAT tip. Thank you so much! This was always bugging me and now it's fixed. Cmd+W to Close Tab, not Window on the last tab should be the default setting!

    • Akshata Shanbhag
      January 22, 2019 at 3:31 pm

      I agree, Alex. It needs to be a default setting. I’m glad I was able to help!