The fastest way to undo is Ctrl+Z on Windows or Command+Z on Mac

Press Ctrl+Z if you are on Windows or Linux. Press Command+Z if you are on Mac. This is the keyboard shortcut that works in nearly every program — word processors, spreadsheets, photo editors, email, browsers, and design software. One press undoes your last action. Press it again to undo the action before that, and keep pressing to step backward through your work.

The shortcut works the same way whether you are typing text, deleting files, moving objects, or changing settings. Most programs let you undo dozens of steps, though some limit how far back you can go. A few older or specialized programs may use a different shortcut, but Ctrl+Z and Command+Z are the standard across Windows, Mac, and Linux.

Key Takeaways

  • Ctrl+Z (Windows and Linux) or Command+Z (Mac) undoes your last action in almost every program on your computer.
  • You can press the shortcut multiple times in a row to undo several actions, stepping backward through your work.
  • If you undo too far, Ctrl+Y or Command+Shift+Z will redo what you just undid.
  • The undo history usually clears when you close a program or restart your computer, so undo only works within a single session.
  • A few programs use different shortcuts, but you can usually find the undo command in the Edit menu if the standard shortcut does not work.

How to undo multiple steps at once

Pressing Ctrl+Z or Command+Z once undoes only the most recent action. If you made five changes and want to go back to the state before all of them, press the shortcut five times. Each press steps back one action.

Some programs show you a list of recent actions so you can jump back to a specific point without pressing the shortcut repeatedly. In Microsoft Word, click the small arrow next to the undo button in the toolbar to see a list of your last actions. Click any action in that list to undo everything from that point forward. Google Docs, Adobe Photoshop, and many other programs have the same feature — look for a dropdown arrow next to the undo icon in the toolbar.

What to do if you undo too far

If you press Ctrl+Z or Command+Z too many times and undo something you wanted to keep, use the redo shortcut to bring it back. Press Ctrl+Y on Windows and Linux, or Command+Shift+Z on Mac. Each press of the redo shortcut restores one action you just undid.

Redo works only when ready after you undo. If you undo five times, then type something new, the redo history disappears and you cannot restore those five actions. The same is true if you close the program — when you reopen it, the undo and redo history is gone.

Where to find undo if the keyboard shortcut does not work

If Ctrl+Z or Command+Z does not work in a particular program, the undo command is almost always in the Edit menu at the top of the window. Click Edit and look for an option that says "Undo" followed by the name of your last action — for example, "Undo Typing" or "Undo Delete". Click it to undo that action.

Some programs also show the keyboard shortcut next to the menu option, which tells you what shortcut that program uses instead of the standard one. A handful of specialized programs, particularly older ones or those designed for specific industries, may use Ctrl+Z for something else entirely. The Edit menu is always the fallback place to look.

Why undo stops working after you close the program

The undo history exists only in your computer's memory while the program is running. When you close the program, that history is erased. If you reopen the program and open the same file, you cannot undo changes you made in the previous session — only changes you make in the current session.

This is why it is important to save your work regularly. If you make a large change and then close the program without saving, undo cannot bring back the old version. Saving creates a permanent record on your hard drive. If you need to go back to an earlier version of a file, you may be able to recover it from your computer's backup or from the program's recovery folder, but that is different from the undo function.

Undo in web browsers and online programs

Ctrl+Z and Command+Z work in most web-based programs like Google Docs, Google Sheets, and online design tools. However, they do not work the same way in regular web browsing. If you press Ctrl+Z while viewing a website, your browser may go back to the previous page instead of undoing text you typed in a form.

If you are filling out a form on a website and need to undo typing, click inside the text box first to make sure the browser knows you are editing text rather than navigating. Then press Ctrl+Z or Command+Z. If the browser goes back a page instead, use the browser's back button to return to the form, and try typing again more carefully.

Programs with limited or no undo history

Most modern programs keep a deep undo history — sometimes 50, 100, or more steps. However, some programs limit how far back you can undo. Older programs or those designed for straightforward tasks may undo only the last 10 or 20 actions. A few specialized programs, particularly some system utilities or command-line tools, may not have undo at all.

If you are working in a program where undo is limited or absent, the safest approach is to save your work frequently under different names. For example, save as "document_v1", then "document_v2", and so on. This way, if something goes wrong, you can close the current version without saving and reopen an earlier one.

Frequently Asked Questions

What is the undo shortcut on a Mac?

Press Command+Z to undo on Mac. To redo, press Command+Shift+Z. These work in nearly all Mac programs the same way Ctrl+Z and Ctrl+Y work on Windows.

Can I undo after I save a file?

Yes. Saving a file does not clear the undo history. You can save your work, then continue making changes and undo those new changes. However, once you close the program, the undo history is gone, and you cannot undo changes from a previous session.

Why does undo not work in my web browser?

In a web browser, Ctrl+Z or Command+Z usually goes back to the previous page rather than undoing text in a form. Click inside the text box you are editing first, then try the undo shortcut. If it still goes back a page, use the browser's back button to return and try again.

Is there a limit to how many times I can undo?

Most programs let you undo dozens of steps, but the limit varies. Some programs show you a list of recent actions so you can see how far back you can go. If you press undo and nothing happens, you have reached the end of the history.

What if I undo something and then make a new change — can I get the undone action back?

No. Once you undo and then make a new change, the redo history is erased. You cannot restore the undone action. This is why redo (Ctrl+Y or Command+Shift+Z) only works when ready after you undo.