To undo on a keyboard, press Ctrl+Z on Windows and Chrome OS, or Command+Z on a Mac. To redo what you just undid, press Ctrl+Y on Windows or Shift+Command+Z on a Mac.
Undo and redo shortcuts by system
| Where | Undo | Redo |
|---|---|---|
| Windows | Ctrl+Z | Ctrl+Y |
| Mac | Command+Z | Shift+Command+Z |
| Word for Microsoft 365 (Windows) | Ctrl+Z | Ctrl+Y |
| Word for Mac | Command+Z or F1 | Command+Y |
| Google Docs (Windows, Chrome OS) | Ctrl+Z | Ctrl+Shift+Z |
| Google Docs (Mac) | Command+Z | Command+Shift+Z |
The shortcuts come from Microsoft, Apple and Google's own shortcut pages, listed under Sources. Each app decides what counts as one "action", so the results can differ slightly between programs.
How to undo on a Windows keyboard
Microsoft's Windows shortcut list gives Ctrl+Z as "Undo the last typing" in text editing and "Undo the previous action" on the desktop. Ctrl+Y is "Redo an action that was previously undone with Ctrl+Z."
Hold Ctrl, tap Z, and release. Repeat to go back further. The Windows page does not say whether Ctrl+Z applies in File Explorer, so check for a result before relying on it there.
How to undo on a Mac keyboard
Apple lists Command-Z as "Undo the previous command." You can then press Shift-Command-Z to redo, reversing the undo command. Apple adds that some apps let you undo and redo multiple commands in sequence.
The Command key is the one with the ⌘ symbol, next to the space bar.
Undo in Word
Word for Microsoft 365 on Windows uses Ctrl+Z to undo and Ctrl+Y to redo. Word's shortcut page also lists F4, which on its own "repeats the last command or action, if possible". That is a repeat key, not a way to redo an undo. Word for Mac accepts Command+Z or F1 to undo and Command+Y to redo.
Undo in Google Docs
Google Docs uses Ctrl+Z to undo and Ctrl+Shift+Z to redo on Windows and Chrome OS. On a Mac they are Command+Z and Command+Shift+Z. If you need an older version of the whole document rather than the last few edits, that is a separate feature (version history), not the undo key.
How undo and redo work together
Most apps keep a list of your recent actions. Each press of the undo shortcut steps back one entry in that list, and each press of the redo shortcut steps forward again. Think of it as a pointer moving along a timeline.
A worked example in a text editor:
- Type "one", then "two", then "three", as separate actions.
- Press undo once. "three" disappears.
- Press undo again. "two" disappears too.
- Press redo once. "two" comes back.
- Type something new. The remaining redo step ("three") is usually discarded, because you have started a new branch of history.
That last step is why people lose work: after you type something new, redo normally cannot bring back what you undid earlier. If you undid too far, redo straight away, before typing anything else. How actions are grouped (a whole word, a pasted block, a formatting change) is up to each app, so one press may reverse more or less than you expect.
Other ways to undo without the shortcut
The keyboard shortcut is the fastest route, but it is not the only one.
- The Edit menu. Many desktop apps have Edit, then Undo, and the menu item shows the shortcut next to it. This is also the quickest way to confirm which keys that app uses.
- A toolbar button. Word and Google Docs show curved-arrow buttons for undo and redo in their toolbars. Hovering over a button normally shows its name and shortcut.
- The context of the task. Deleting a file in File Explorer, editing a photo and writing code in an editor are three different tools with three different histories. Undo in one does not reach into another.
Habits that make undo less necessary
- Save before big edits. A save point gives you something to return to if the undo history is lost, for example after closing and reopening the file.
- Undo in small steps. Press the shortcut once, look at the screen, and press again only if needed. Holding the keys down can run through many steps quickly.
- Keep a copy. For important documents, duplicate the file before a major rewrite. Undo history usually does not survive closing the app.
If undo does not work
- Click into the document first. The shortcut goes to whichever window or field has focus. If focus is on a toolbar or another panel, the key press does not reach your text.
- Look at the Edit menu. In most apps, Edit shows "Undo" followed by the name of the action. If it is greyed out, the app has nothing to undo.
- Some actions cannot be undone. That depends on the app. Closing a document without saving, or emptying a recycle bin, is usually not reversible with the undo key.
- Another app owns the shortcut. A remote desktop or virtual machine window may send
Ctrl+Zto the other system instead of your own.
For version control, undoing a commit is a different job. See how to undo the last Git commit.
Frequently asked questions
- What is the keyboard shortcut to undo?
- On Windows and Chrome OS it is Ctrl+Z. On a Mac it is Command+Z. Press it repeatedly to step back through earlier actions, in apps that keep more than one step of history.
- How do I redo after undoing?
- On Windows, press Ctrl+Y. On a Mac, press Shift+Command+Z. Google Docs on Windows and Chrome OS uses Ctrl+Shift+Z instead of Ctrl+Y.
- Why does Ctrl+Z do nothing?
- The app may have no undo history for that action, or the action cannot be undone. Click inside the document first so it has keyboard focus. Some apps limit undo to certain kinds of actions, so check the app's Edit menu to see whether Undo is greyed out.
- What does F4 do in Word?
- In Word for Microsoft 365 on Windows, F4 on its own repeats the last command or action, if possible. It is not an undo or redo key, although Word lists it next to them.