The basic way to close a window
To close a window, look for the X button in the top right corner of that window (on Windows computers) or the top left corner (on Mac computers). Click it once. The window disappears, and you return to whatever was behind it.
That is the most direct method. The window closes, but the program that created it usually stays running in the background — you can open a new window from that program later without restarting it.
If you cannot see the X button clearly, move your mouse to the very top corner of the window. The button appears when you get close, or it may already be visible as a small square or circle with an X inside.
Key Takeaways
- Click the X button in the top corner of any window to close it without closing the entire program.
- Closing a window is different from closing a program — the program keeps running unless you close it separately.
- If a window will not close, you can force it shut using Task Manager on Windows or Force Quit on Mac.
- Keyboard shortcuts like Alt+F4 on Windows or Command+W on Mac close the active window when ready.
- Some programs show a save dialog when you close them, asking whether you want to keep unsaved changes.
When a window asks you to save before closing
If you have made changes to a document or file inside the window, the program may show a dialog box when you try to close it. The dialog asks whether you want to save your changes, discard them, or cancel the close action.
Click Save if you want to keep the changes you made. Click Don't Save or Discard if you want to close without saving — the changes disappear. Click Cancel if you change your mind and want to keep the window open.
This safety feature prevents you from accidentally losing work. If you are unsure whether you want to keep the changes, click Cancel, review your work, and then close again when you are ready.
Using keyboard shortcuts to close windows
On Windows computers, press Alt+F4 to close the active window when ready. On Mac computers, press Command+W. These shortcuts work in almost every program and are faster than moving your mouse to the X button.
If you want to close the entire program (not just one window), use Alt+F4 on Windows or Command+Q on Mac. This closes all windows belonging to that program and shuts it down completely.
Keyboard shortcuts are especially useful when you have many windows open and want to close them quickly without clicking each one individually.
What happens when you close a window versus closing a program
Closing a window and closing a program are two different actions. When you close a window, that specific window disappears, but the program itself continues running. You can open a new window from the same program without restarting it.
When you close a program, all of its windows close at once, and the program stops running entirely. The program no longer uses your computer's memory or processing power until you open it again.
For example, if you have three document windows open in Microsoft Word and you close one window, the other two stay open and Word keeps running. If you close Word itself, all three windows close and Word stops running.
Forcing a window to close when it is frozen
Sometimes a window stops responding to clicks and will not close normally. On Windows, open Task Manager by pressing Ctrl+Shift+Esc or right-clicking the taskbar at the bottom of your screen. Find the frozen program in the list, click it once to select it, then click the End Task button at the bottom right.
On Mac, press Command+Option+Esc to open the Force Quit window. Select the frozen program and click Force Quit. The program closes when ready, though any unsaved work in that program will be lost.
Force quitting should only be used when a window truly will not respond. It bypasses the normal save dialog, so you may lose recent changes.
Closing multiple windows at once
If you have many windows open from the same program, you can close them all at once by closing the program itself rather than closing each window individually. On Windows, press Alt+F4 when any window from that program is active. On Mac, press Command+Q.
Some programs also let you close multiple windows by right-clicking the program icon in the taskbar (Windows) or dock (Mac) and selecting an option like "Close All" or "Quit". The exact wording depends on the program.
If the program shows a save dialog, you may be asked whether to save changes in each window, or the program may ask once for all unsaved changes at once. Follow the prompts to decide what to save.
Why windows sometimes reopen when you restart your computer
Some programs remember which windows were open when you closed them and reopen those same windows the next time you start the program. This is a convenience feature — you return to where you left off without having to manually reopen files.
If you do not want this to happen, close the program completely before shutting down your computer, rather than just closing individual windows. Some programs also have a setting in their preferences or options menu to turn off this "restore session" feature.
This behavior is normal and not a sign that something is wrong. If you prefer a fresh start each time you open a program, look in that program's settings for an option to disable session restoration.
Frequently Asked Questions
What is the difference between minimizing and closing a window?
Minimizing hides the window but leaves the program running. The window appears as a button in your taskbar (Windows) or dock (Mac), and you can click it to bring the window back. Closing removes the window entirely, though the program usually keeps running in the background.
Can I undo closing a window if I closed it by accident?
If you closed a window with unsaved work, you cannot undo the close action itself. However, many programs let you reopen recently closed files through a menu option like "Recent Files" or "Open Recent". If the program was still running, you may also be able to recover the file through the program's recovery feature.
Why does my window close when I click the X button but the program stays open?
This is normal behavior. The X button closes only that window, not the entire program. The program continues running in the background so you can open new windows from it without restarting. To close the program completely, use Alt+F4 on Windows or Command+Q on Mac.
What should I do if a window will not close no matter what I click?
The window is likely frozen. Use Task Manager on Windows (Ctrl+Shift+Esc) or Force Quit on Mac (Command+Option+Esc) to shut down the program. This closes all windows from that program at once. You may lose unsaved work, but it is the only way to recover when a window stops responding.
Do I need to close windows before shutting down my computer?
You do not have to, but it is a good habit. Closing programs before shutdown gives them a chance to save any unsaved work and close cleanly. If you leave programs running when you shut down, you may lose recent changes or cause the program to behave oddly the next time you open it.