How to make Firefox ask before closing multiple tabs

Martin Brinkmann
Updated •
Firefox

Firefox does not ask before closing a window with multiple tabs by default (that changed in Firefox 94). To turn the warning back on, open Settings, go to the General panel, scroll to Tabs and check "Ask before closing multiple tabs". The same switch is the about:config preference browser.tabs.warnOnClose: set it to true to get the confirmation prompt, false to close without asking.

This guide covers the Settings option, the about:config preferences behind each close and quit warning, how the quit shortcuts differ on Windows, macOS and Linux, and what to do if you already closed a window by accident.

How to enable "Ask before closing multiple tabs" in Firefox

The "Ask before closing multiple tabs" checkbox in Firefox's General settings turns the close confirmation on or off. When it is checked, Firefox shows a dialog with a Close tabs button whenever you close a window or quit the browser with several tabs open. It works the same in Firefox on Windows, macOS and Linux.

  1. Click the menu button (three lines) in the toolbar and select Settings. On macOS you can also use Firefox > Settings in the menu bar.
  2. Stay in the General panel, or type about:preferences into the address bar and press Enter.
  3. Scroll to the Tabs group in the "Tabs and browsing" section.
  4. Check "Ask before closing multiple tabs".

The change applies immediately; no restart is needed. Uncheck the box to return to Firefox's default behavior, which closes the window without asking.

Firefox settings Tabs section with the option to confirm before closing multiple tabs

Once enabled, the prompt appears when you click the window's close button, use the menu's Quit or Exit entry, or press a quit shortcut. You can also switch the warning off directly from the prompt itself, which flips the same setting.

Firefox confirmation dialog asking whether to close a window with multiple tabs

browser.tabs.warnOnClose and the other close preferences in about:config

browser.tabs.warnOnClose is the about:config preference behind the "Ask before closing multiple tabs" checkbox, and its default value in current Firefox builds is false. Changing it in about:config has exactly the same effect as ticking the box in Settings.

  1. Type about:config into the address bar and press Enter.
  2. Click "Accept the Risk and Continue" if the warning page appears.
  3. Paste browser.tabs.warnOnClose into the search field.
  4. Click the toggle button to switch between true (warn) and false (no warning).

The browser.tabs.warnOnClose preference in Firefox about:config

Firefox has several related preferences. These are the defaults in Mozilla's current preference file:

Preference Default What it controls
browser.tabs.warnOnClose false Prompt when closing a window or quitting with multiple tabs
browser.tabs.warnOnCloseOtherTabs true Prompt when closing several tabs at once from the tab context menu
browser.warnOnQuitShortcut false on Windows, true on macOS and Linux Prompt when quitting with the keyboard shortcut
browser.warnOnQuit true Master switch: false suppresses all quit and restart prompts
browser.quitShortcut.disabled false Set to true so the quit keyboard shortcut no longer quits Firefox

If the prompt never appears even though browser.tabs.warnOnClose is true, check that browser.warnOnQuit has not been set to false, because that value overrides every other quit prompt.

Why Firefox stopped asking before closing tabs

Mozilla made Firefox close windows without a prompt by default starting with Firefox 94, released in November 2021. Earlier versions asked for confirmation whenever a window with multiple tabs was closed, and offered no Settings option to bring the prompt back once it had been dismissed.

Mozilla explains the reasoning on its close tab warnings support page: closing a window with a menu, a button or a three-key command is likely intentional, so a warning would add "unnecessary and perhaps unwelcome interruption". In exchange, Firefox 94 added the checkbox to Settings, so users who want the safety net can switch it on in one click.

The one warning that stayed on by default covers two-key quit shortcuts on macOS and Linux. There the quit shortcut sits right next to the shortcut for switching applications, so an accidental quit is far more likely than with a deliberate click on the close button.

Quit shortcut warnings on Windows, macOS and Linux

Firefox's quit shortcut and its warning differ by operating system. On Windows the quit shortcut is Ctrl+Shift+Q, a three-key combination that is hard to press by mistake, so the shortcut warning is off by default. On macOS the shortcut is Command+Q and on Linux it is Ctrl+Q, and both warn by default.

  • macOS: Settings shows a separate checkbox, "Ask before quitting with ⌘Q", in the Tabs group.
  • Linux: the matching checkbox reads "Ask before quitting with Ctrl+Q".
  • Windows: there is no separate checkbox; "Ask before closing multiple tabs" covers Ctrl+Shift+Q as well.

If you never use the shortcut and keep hitting it by accident, setting browser.quitShortcut.disabled to true in about:config stops the quit shortcut (Ctrl+Q, Command+Q or Ctrl+Shift+Q) from quitting Firefox at all. Restart Firefox after changing it. Chrome went further years ago and changed how its own Ctrl+Shift+Q exit shortcut works for the same reason.

How to get tabs back after closing Firefox by accident

Firefox can restore a window you closed by mistake, even without the close warning. Press Ctrl+Shift+N (Command+Shift+N on macOS) to reopen the last closed window, or Ctrl+Shift+T (Command+Shift+T) to reopen recently closed tabs one by one.

  • After quitting the whole browser, open the History menu and choose "Restore previous session" on the next start.
  • To reopen your tabs automatically every time, check "Open previous windows and tabs" in the Startup part of the General settings.
  • For a longer list of closed tabs, an undo close tab add-on shows recently closed tabs in one click.

If session restore itself fails, follow the steps to restore Firefox sessions manually from the sessionstore backup files in your profile folder.

FAQ

Does the close warning save my tabs?

No. The prompt only asks for confirmation; it does not save anything. To keep tabs between sessions, enable "Open previous windows and tabs" or bookmark them.

Can I protect individual tabs from being closed?

Pinned tabs cannot be closed with Ctrl+W or Command+W, which makes pinning a simple way to protect important tabs. Right-click the tab and select Pin Tab.

Why does the warning still not appear after I enabled it?

Check about:config for browser.warnOnQuit: if it is false, Firefox suppresses all quit prompts. Also note that the warning only appears when the window has more than one tab open.

Related: bookmark all open tabs in Firefox, enable tab groups in Firefox

Comments

  1. seberhusky said on
    Reply

    Whoever is in charge at firefox and their zoomer staff are grade-A idiots. They are too lazy to program a menu toggle to enable or disable this feature, so they just take it away entirely and then make the baseless LIE that “nobody is using it” who are they to tell people that? who do you think you are? The number of times I have went to minimize firefox and accidentally closed it instead happens more times than I can count. STOP DESTROYING FIREFOX.

  2. Tammy said on
    Reply

    No problem anymore
    the option is now under tools
    under general under tab select Confirm before closing multiple tabs

  3. Anonymous said on
    Reply

    I’ve just lost several hours of online radio recordings preserved in a special widget present on the radio station web page. Was trying to find time to record them to my hard drive. Thank you Mozilla brainiacs.

    1. Tammy said on
      Reply

      That does not sound like firefoxex fault. It sounds like the radio web you were on. How was it firefox fault you lost that on a website they have no control over.

      1. johndoe said on
        Reply

        It is firefox’s fault because they didn’task before closing the window. stop virtue signaling and defending bad design. you aren’t getting paid money for every comment you make defending them. grow a brain.

  4. Craig said on
    Reply

    Actually….. I just bought a new Lenovo with Windows 11 and there is a SIMPLE FIX to this problem:
    1. Click on the 3 lines in top right corner of the window under the X for closing the window
    2. Click “Settings”
    3. Check the box for “Confirm before closing multiple tabs”

    That simple! I always use Firefox.

  5. Alex B said on
    Reply

    At the moment I have over 100 tabs open in one window. I consider these tabs as valuable data and I have set Firefox to open the previous tabs on start. Previously, if I happened to have another window open (maybe minimized or hidden in the background) and I attempted to close 100+ tab window, Firefox would warn me about losing the tabs. If I had only the 100+ tabs window open, Firefox would just remember the tabs and not warn when closing it.

    Now I don’t get the warning and I may lose the data about the 100+ open tabs.I can enable the “Confirm before closing multiple tabs” setting, but then Firefox will always warn when closing the 100+ window even if I don’t have any additional windows open. Also the warning only says that the tabs will be closed, but I doesn’t tell if they will be reopened.

    I very much prefer the old behavior.

  6. virevoks said on
    Reply

    I have it whenever the Firefox dev team just decides which is best for me. Firefox used to be a highly customizable browser. Now it’s just becoming a Google Chrome clone. If I want to use a browser that works like Chrome, then I use Chrome. They have changed this setting a zillion times, and reset it in some updates, that is really frustrating. Even though I was again able to re-enable the setting, now I don’t know anymore if the tabs will be restored (i.e., if this was the last window). Please, STOP DUMBING DOWN FIREFOX.

  7. Pissed said on
    Reply

    This is a stupid move! The STRESS of losing work from accidentally closing a window full of tabs is FAR GREATER than the supposed “friction” of having a confirmation message. I really prefer the confirmation because I can sometimes accidentally click Close and I don’t want to reload all the tabs or lose any form data. So, I really disagree this kind of Google-Chrome-ish attitude of changing defaults without warning that Mozilla is adopting. It is so hard to find a browser these days that actually respects their variety of users instead of pushing their “we know better than you what you need” bs agenda!

    At least, there should have been a choice. Like, after updating, a page saying “Hey! Thanks for updating. Here are some settings for which the defaults have changed. If you wish, you can change back or keep the new defaults:”

  8. Gimme said on
    Reply

    So now the question is, how do you find out how many tabs you had open. Before this most recent useless change, Firefox would warn you that you are about to close 365 tabs, for example and it also said that these would all be opened upon restarting Firefox. So, I like to know how many tabs I have. What’s the solution?

    1. owl said on
      Reply

      @Gimme,
      > So, I like to know how many tabs I have. What’s the solution?

      A practical solution is to use extensions (Add-ons).
      I am using the extension “FoxyTab”.
      FoxyTab | addons.mozilla.org
      https://addons.mozilla.org/en-US/firefox/addon/foxytab/
      https://addons.mozilla.org/en-US/firefox/addon/foxytab/

      If you simply want to display the number of tabs, the extension “Tab counter” is a good choice.
      Tab counter | addons.mozilla.org
      https://addons.mozilla.org/en-US/firefox/addon/tabcounter-1/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search

      1. gimme said on
        Reply

        Thanks owl! :)

    2. Gimme said on
      Reply

      Disregard. At first it didn’t show how many tabs. Now it does. Good grief Firefox! ugh.

  9. Stan said on
    Reply

    If I lost all my tabs in the 4 or 5 Firefox windows I keep open, it will result in massively ‘unwelcome friction.’
    When I close FF: ? > Exit (Ctrl+Shift+Q) closes all windows and they all come back on when restarted.

    Opening Firefox with tabs from previous session on startup would be a lifesaver.

  10. a:c said on
    Reply

    Another closely related is..

    browser.tabs.closeWindowWithLastTab false

  11. syrup said on
    Reply

    Note the behaviour of browser.tabs.warnOnClose has changed subtly for users who have “restore previous session” (renamed “open previous windows and tabs” in 94) enabled. In 93 and before, the warning would be skipped when closing the last window, as it’s going to be restored anyway, but 94 doesn’t make that exception and will display the warning regardless. That may frustrate users who relied on the warning as a cue they’re about to accidentally nuke their main window, and otherwise annoy them with an unnecessary prompt on exit.

    For those users, suggestion would be to consider letting go of browser.tabs.warnOnClose, as the “recently closed windows” menu option (under History) seems to have gotten pretty good at undoing mistakes.

  12. beemeup5 said on
    Reply

    Anyone remember the “Save and quit” button? It was useful to be able to choose when you actually wanted to save a session. Also the SessionManager addon is one of the most important addons I use so thank god Pale Moon still supports it.

    1. owl said on
      Reply

      @beemeup5,

      This is not a straight answer to your “question”, but I prefer “Tab Stash”.

      Tab Stash: A no-fuss way to save and organize batches of tabs as bookmarks. Only for Firefox.
      https://josh-berry.github.io/tab-stash/

      In the past, I have used “OneTab” and “Tab Session Manager”, but the current means was “easy, security, and reliable”.

      Incidentally, I don’t keep any “history” for security reasons, and prefer to “delete all cookies and cache immediately” even when I am browsing. Therefore, it is not possible (I’m not holding my breath.) to recover from history, etc.

  13. one two three said on
    Reply

    Gee, thanks Mozilla. What a valuable change. I hope it cost a lot in brainstorming and programming.

    I can just imagine a crowd of people huddled around a very long table and some stupid @?$* saying, “I HAVE IT! I have the great idea! Let’s remove the multiple tab prompt!” “GENIUS!”

  14. WEnd WEnd said on
    Reply

    Mozilla is really trying to kill Firefox.

  15. Bob said on
    Reply

    I like the “safety net” of this prompt.

    One they could get rid of is the “Update available” one. I’ll update my browser when I feel like it thanks.

  16. JuhaT said on
    Reply

    Annoying prompt, but you only had to see it once really, pretty easy to disable it in the first prompt. But I wont miss it.

  17. ULBoom said on
    Reply

    One of the few annoyances I keep active.

    The part of the article where Mozilla claims Windows users are more aware than Mac or Linux users is just plain bizarre. Mac, maybe. Linux, no way.

  18. Mo said on
    Reply

    Good I don’t like the prompt, but I am sure there are users who do or could use it. Good to have options.

  19. Anonymous said on
    Reply

    Closing the prompt takes a second or two.
    Accidentally closing tabs will, for many users, take far more than a second or two and you know could actually lead to ‘unwelcome friction’.

    It should not be necessary to solve a problem that did not exist by using the ‘çonfig’ option.

  20. Paul(us) said on
    Reply

    Great article again Martin,
    You are writing “Mozilla Firefox 94 won’t prompt users anymore”
    I have Mozilla Firefox 93.0.0 stable but I have already that the tabs are closing without a warning and the possibility in the settings, to change that like you mentioned it in above article?

    I do not agree at all with Firefox organization that close actions in the contexts mentioned are “likely intentional”, and that the prompt is “unnecessary” and may provide “unwelcome friction”.

    People have said to me that the function is for small children.
    But I am loving the feature. Please keep it Mozilla Firefox.
    Instead of loosing it give people a option to loose it in the setting please.

    1. Tom Hawack said on
      Reply

      // Closing Multiple Tabs Prompt
      pref(“browser.tabs.warnOnCloseOtherTabs”, true);

  21. Anonymous said on
    Reply

    F*ing idiots at mOZILLA are at it again. Last years all they have done is remove useful and good features, while spending exorbitant time “fixing” address bar and make it much worse.

    1. Anonymous said on
      Reply

      Yup, whoever in charge there is trying to make it tank below 1% market share I guess… This is sad.

  22. Fredo said on
    Reply

    You can still set Firefox to open with tabs from previous session on startup.
    With that set, you don’t need a warning, but can simply re-open Firefox if you accidently closed it.

    1. Bob said on
      Reply

      This is not a solution: formerly this was the same. The diff was that it asks/info you only and just if you have more the one instance of FF open. In such a case it (what you mentioned) doesn’t help, when you close the “main” browser with tons of Tabs as first…

    2. Yash said on
      Reply

      Same.

  23. owl said on
    Reply

    > Now you: do you use the close confirmation prompt?

    I often accidentally close my browser and leave so many tabs open that “Tree Style Tab” is essential (add Auto Tab Discard, Cookie AutoDelete, and LocalCDN), so I need to be prompt.

    Well, not only Firefox, but I have it set to “prompt me in situations where the state changes” in every program.
    It is true that many users dislike the “prompt” as annoying, so I have seen many programs that have made the prompting feature an opt-in option or removed it.
    In programs that do not provide prompting, I add a “prompt” function in a third-party application or similar.

    1. Anonymous said on
      Reply

      lies! the devs said it’s intentional, no accidental close whatsoever

  24. Tom Hawack said on
    Reply

    I’ve always set ‘browser.tabs.warnOnClose’ = false
    —
    Regarding CTRL+SHIFT+Q, I read many complaints about this but given I’m a mouse aficionado rather than a keyboard fan, it doesn’t bother me.
    —
    What does bother me is that if I have several Firefox windows opened, closing Firefox only closes the current Firefox window, good and normal except that other windows include those such as Library (which is still not displayed in a tab), Page Info etc … and that I more than once had only one Firefox GUI opened but as well Library, Page Info, and that closing the Firefox GUI didn’t close the latter, which meant Firefow was still opened. Which is why I’ve added an ‘Exit Firefox’ button (userChromeJS crafted) next to Firefox’s Buttonbox which closes *all* Firefox opened Windows (‘EX’, as well as ‘RS’ to Restart (also a userChromeJS) , and Clock (extension manipulated with CSS) on the left as viewable here : [https://img.justpaste.me/i/20211028/mg13z/ButtonBoxPlus.png].

    There is a lesser known about:config pref which allows to consider all opened Firefox windows when closing Firefox : privacy.clearOnShutdown.openWindows // Default=false
    If set to true closing Firefox will close all Firefox windows, like my userChromeJS above mentioned, but IMO defaulting Firefox exit to exiting all opened Firefox windows is not a wise idea. The extra button is less problematic.

Leave a Reply

By commenting, you accept our privacy policy and keep the discussion respectful and on topic.