How to Close an Excel File With a Keyboard Shortcut

How-to basics · Updated November 20, 2026

In Excel for Microsoft 365 on Windows, press Ctrl+W to close the active workbook. If you have unsaved changes, choose whether to save them when Excel asks. This closes the file, not necessarily the Excel app; use Alt+F4 when you intend to exit Excel entirely.

What You’ll Need

  • A Windows computer with the desktop version of Microsoft Excel open, and a workbook you want to close.
  • A keyboard. If the workbook has changes you want to keep, be ready to save them or respond to Excel’s save prompt.

You do not need to select a cell first. The shortcut acts on the active workbook, meaning the workbook currently in front. If you are using Excel in a browser, skip to the browser notes below: browser shortcuts can behave differently from desktop Excel.

Step-by-Step

  1. Check which workbook is active. Look at the title bar or the open workbook window. If several files are open, click the one you want to close before using the shortcut. Ctrl+W applies to the active workbook, not necessarily every file open in Excel.
  2. Finish any cell edit in progress. If the cursor is inside a cell or the formula bar, press Enter to commit the edit, or Esc to cancel it. Then make sure you are back in the worksheet. This avoids confusing a cell-editing action with a workbook-closing action.
  3. Save first if you already know you want to keep your changes. Press Ctrl+S. If the file has never been saved, Excel opens a Save As dialog. Choose a location, enter a file name, and confirm Save. Once the save is complete, the workbook is ready to close.
  4. Press Ctrl+W. Hold Ctrl, tap W once, and release both keys. Excel closes the active workbook. You do not need to hold the keys down, and you should not press the shortcut repeatedly while Excel is responding.
  5. Respond to the save prompt if it appears. If Excel asks whether to save changes, choose Save to keep them, Don’t Save to discard them, or Cancel to return to the workbook without closing it. Read the prompt before choosing; Don’t Save cannot be reversed with Undo.
  6. Check what remains open. If another workbook was open, Excel may display it next. If no other workbook is open, you may see Excel’s start screen or a blank application window. That does not necessarily mean the file failed to close.
  7. Exit Excel only if that is your goal. To close the entire Excel application on Windows, press Alt+F4. Save prompts may appear for any other open workbooks too. If you only wanted to close one file, use Ctrl+W instead and leave Excel running.

There is also a useful distinction between closing a workbook and closing the program. Ctrl+W is the usual choice for one file; Alt+F4 is the Windows command to quit the application. If multiple workbooks are open, close them one at a time with Ctrl+W, or use Alt+F4 to exit Excel and deal with any save prompts as they appear.

On a Mac: Press Command+W to close the active workbook window. Press Command+Q to quit Excel. The Control key is not a substitute for Command in these Mac shortcuts. If prompted to save, choose the appropriate save, discard, or cancel option before continuing.

In Excel for the web: The workbook is open in a browser tab, so Ctrl+W on Windows may close the tab rather than invoke a desktop Excel workbook command. Excel for the web generally saves changes automatically, but check the save status before leaving. To leave the workbook, close its browser tab using the browser’s tab controls or shortcut; be sure you have the correct tab selected.

Common Mistakes

  • Using Alt+F4 when you only mean to close one file. Alt+F4 exits Excel on Windows. It can affect all workbooks open in the application and may trigger multiple save prompts. Use Ctrl+W for the active workbook.
  • Choosing Don’t Save without checking. That choice discards the changes made since the last save. If you are unsure, choose Cancel, review the workbook, and save a copy or save the current file before closing.
  • Assuming Excel has quit because the workbook disappeared. Closing the last workbook can leave Excel’s start screen open. The file is closed even if the application remains running.
  • Pressing the shortcut while a dialog or cell editor is active. Excel may apply keys to the current dialog or editing field, or the shortcut may not act as expected. Complete or cancel the current action and return focus to the worksheet first.
  • Using the desktop shortcut in a browser. A browser can reserve Ctrl+W for closing the current tab. In Excel for the web, treat that as a browser-tab action, not a guarantee that an Excel desktop workbook command has run.
  • Repeatedly pressing Ctrl+W because nothing happened instantly. Large files, calculations, network locations, or a busy computer can delay the response. Wait a moment and check for a prompt before trying again.

Tips

  • Save before closing when you want a predictable result. Ctrl+S followed by Ctrl+W is an easy two-shortcut routine. The save prompt is still useful as a final check if you made another change after saving.
  • Use the prompt to make a deliberate choice. Save keeps recent edits in the workbook; Don’t Save closes without keeping those edits; Cancel leaves the workbook open. If the workbook is important, avoid choosing under time pressure.
  • Keep the app open when switching files. Close the current workbook with Ctrl+W, then open another file from Excel’s start screen or through File > Open. This is different from quitting and relaunching Excel.
  • Use the right Mac equivalent. On Mac, Command+W closes a window and Command+Q quits the app. Remembering the separate close and quit commands can help avoid closing more than intended.
  • Check the file location before closing a new workbook. If you created a workbook and have not saved it before, the save prompt is your opportunity to name it and choose where it belongs. Do not assume a new file already has a permanent location.
  • Close the correct browser tab when using Excel online. If several spreadsheets are open in tabs, read the tab title or switch to the workbook first. A browser close shortcut may close a different page if another tab has focus.

Troubleshooting

Ctrl+W does nothing: First check that the desktop Excel window is active, rather than another program. Click the workbook, finish any active cell edit with Enter or Esc, and try Ctrl+W once more. If a dialog is open, complete or cancel it before trying again. On some keyboards, make sure you are pressing the Ctrl key rather than the Windows key.

The file closes without asking me to save: Excel may not detect unsaved changes, or your latest edits may already have been saved. Reopen the workbook and check the relevant cells. If you expected a change to be there, look for another copy or location of the file, and check Excel’s available version history or recovery options. Do not assume that closing itself saved every change.

I see a save prompt but cannot tell what to choose: Choose Save if you want to preserve the latest edits. Choose Don’t Save only if you intentionally want to discard them. Choose Cancel if you need time to inspect the workbook. When in doubt, cancel, use Save As to create a separate copy, and then close the copy or original as appropriate.

Excel closed, but I still see a window: The workbook may have closed while Excel stayed open at its start screen or with another workbook. Look for another open workbook window. If you actually need to quit the program, use Alt+F4 on Windows or Command+Q on Mac.

Ctrl+W closed my browser tab: You were probably using Excel for the web, or the browser had focus. Reopen the tab from the browser’s recently closed tabs if needed, then check whether the workbook is available and whether changes have synced. In the web version, use the browser’s controls to leave the page and check the workbook’s save indicator before doing so.

The shortcut seems blocked by an add-in, remote desktop, or keyboard layout: Use the on-screen menu as a fallback: in desktop Excel for Windows, choose File > Close to close the current workbook. If your goal is to quit Excel, close the app separately. If the shortcut works in other programs but not Excel, check whether a dialog, remote-session setting, or add-in is intercepting the key combination.

Frequently Asked Questions

What is the keyboard shortcut to close an Excel file on Windows?
In the Excel desktop app, press Ctrl+W to close the active workbook. Excel may ask whether to save changes before it closes.

Does Ctrl+W close Excel completely?
Usually, it closes the active workbook, not the whole application. To quit Excel on Windows, use Alt+F4. Save any other open workbooks if prompted.

How do I close an Excel file on a Mac with the keyboard?
Press Command+W to close the active workbook window. Use Command+Q to quit Excel entirely. Save prompts work the same way in principle: choose whether to save, discard, or cancel.

Will Ctrl+W delete my Excel file?
No. It closes the open workbook; it does not delete the saved file from your computer or cloud storage. Choosing Don’t Save discards unsaved changes, but it does not remove the previously saved file.

How can I close Excel without saving my changes?
Press Ctrl+W on Windows, then choose Don’t Save when Excel asks. On Mac, use Command+W and choose the option to discard changes. Be certain you do not need those edits, because they will not be kept in the workbook.

Does Ctrl+W work in Excel for the web?
It may close the browser tab rather than close a workbook inside the browser. Check that the workbook has saved, then use the browser’s tab controls to leave. Desktop Excel and Excel for the web do not handle this shortcut in the same way.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.